Skip to content

Commit a0ba445

Browse files
committed
Make buffer size configurable at compile time and set it to 8192
1 parent e383cb7 commit a0ba445

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ libmpdclient 2.20 (not yet released)
99
- albumart
1010
* support tags "ComposerSort", "Ensemble", "Movement",
1111
"MovementNumber", "Location"
12+
* configurable buffer size, increase default from 4096 to 8192
1213

1314
libmpdclient 2.19 (2020/07/03)
1415
* fix off-by-one bug in MPD_HOST parser

meson.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ conf.set('DEFAULT_PORT', get_option('default_port'))
2121

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

24+
conf.set('BUFFER_SIZE', get_option('buffer_size'))
25+
2426
platform_deps = []
2527
if host_machine.system() == 'haiku'
2628
platform_deps = [cc.find_library('network')]

meson_options.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ option('documentation', type: 'boolean',
2121
option('test', type: 'boolean',
2222
value: false,
2323
description: 'Enable unit tests')
24+
25+
option('buffer_size', type: 'string',
26+
value: '8192',
27+
description: 'response buffer size')

src/buffer.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
#ifndef MPD_BUFFER_H
3030
#define MPD_BUFFER_H
3131

32+
#include "config.h"
33+
3234
#include <assert.h>
3335
#include <string.h>
3436
#include <stdbool.h>
@@ -45,7 +47,7 @@ struct mpd_buffer {
4547
unsigned read;
4648

4749
/** the actual buffer */
48-
unsigned char data[4096];
50+
unsigned char data[BUFFER_SIZE];
4951
};
5052

5153
/**

0 commit comments

Comments
 (0)