Skip to content

Commit

Permalink
Make buffer size configurable at compile time and set it to 8192
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorporation committed Jul 17, 2021
1 parent e383cb7 commit a0ba445
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ libmpdclient 2.20 (not yet released)
- albumart
* support tags "ComposerSort", "Ensemble", "Movement",
"MovementNumber", "Location"
* configurable buffer size, increase default from 4096 to 8192

libmpdclient 2.19 (2020/07/03)
* fix off-by-one bug in MPD_HOST parser
Expand Down
2 changes: 2 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ conf.set('DEFAULT_PORT', get_option('default_port'))

conf.set('HAVE_STRNDUP', cc.has_function('strndup', prefix: '#define _GNU_SOURCE\n#include <string.h>'))

conf.set('BUFFER_SIZE', get_option('buffer_size'))

platform_deps = []
if host_machine.system() == 'haiku'
platform_deps = [cc.find_library('network')]
Expand Down
4 changes: 4 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ option('documentation', type: 'boolean',
option('test', type: 'boolean',
value: false,
description: 'Enable unit tests')

option('buffer_size', type: 'string',
value: '8192',
description: 'response buffer size')
4 changes: 3 additions & 1 deletion src/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#ifndef MPD_BUFFER_H
#define MPD_BUFFER_H

#include "config.h"

#include <assert.h>
#include <string.h>
#include <stdbool.h>
Expand All @@ -45,7 +47,7 @@ struct mpd_buffer {
unsigned read;

/** the actual buffer */
unsigned char data[4096];
unsigned char data[BUFFER_SIZE];
};

/**
Expand Down

0 comments on commit a0ba445

Please sign in to comment.