aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-17 20:23:58 +0100
committerMax Kellermann <max@duempel.org>2009-01-17 20:23:58 +0100
commit0b29a22c088462f2d2c0fba8363423bd2ab41f1a (patch)
tree136eb8698c082242e896a71bfaa33e5138e026a6 /src
parent7acc62366cb59aba414821563cc89e01e96c1987 (diff)
downloadmpd-0b29a22c088462f2d2c0fba8363423bd2ab41f1a.tar.gz
mpd-0b29a22c088462f2d2c0fba8363423bd2ab41f1a.tar.xz
mpd-0b29a22c088462f2d2c0fba8363423bd2ab41f1a.zip
conf: replaced getConfigParamValue() with config_get_string()
Don't return a writable pointer.
Diffstat (limited to 'src')
-rw-r--r--src/conf.c7
-rw-r--r--src/conf.h3
-rw-r--r--src/database.c5
-rw-r--r--src/pcm_resample_libsamplerate.c2
-rw-r--r--src/tag_id3.c4
5 files changed, 12 insertions, 9 deletions
diff --git a/src/conf.c b/src/conf.c
index f8ee5519a..f71ace7f2 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -376,12 +376,13 @@ config_get_next_param(const char *name, struct config_param * last)
return param;
}
-char *getConfigParamValue(const char *name)
+const char *
+config_get_string(const char *name, const char *default_value)
{
struct config_param *param = config_get_param(name);
- if (!param)
- return NULL;
+ if (param == NULL)
+ return default_value;
return param->value;
}
diff --git a/src/conf.h b/src/conf.h
index 435adf694..01a2e5e17 100644
--- a/src/conf.h
+++ b/src/conf.h
@@ -98,7 +98,8 @@ config_get_param(const char *name)
return config_get_next_param(name, NULL);
}
-char *getConfigParamValue(const char *name);
+const char *
+config_get_string(const char *name, const char *default_value);
struct block_param *
getBlockParam(struct config_param *param, const char *name);
diff --git a/src/database.c b/src/database.c
index 46c09281f..cb9d92819 100644
--- a/src/database.c
+++ b/src/database.c
@@ -281,7 +281,7 @@ db_load(void)
foundVersion = true;
} else if (g_str_has_prefix(buffer, DIRECTORY_FS_CHARSET)) {
char *fsCharset;
- char *tempCharset;
+ const char *tempCharset;
if (foundFsCharset)
g_error("already found fs charset in db");
@@ -289,7 +289,8 @@ db_load(void)
foundFsCharset = true;
fsCharset = &(buffer[strlen(DIRECTORY_FS_CHARSET)]);
- if ((tempCharset = getConfigParamValue(CONF_FS_CHARSET))
+ tempCharset = config_get_string(CONF_FS_CHARSET, NULL);
+ if (tempCharset != NULL
&& strcmp(fsCharset, tempCharset)) {
g_message("Using \"%s\" for the "
"filesystem charset "
diff --git a/src/pcm_resample_libsamplerate.c b/src/pcm_resample_libsamplerate.c
index 5d2c31c1c..2e942b024 100644
--- a/src/pcm_resample_libsamplerate.c
+++ b/src/pcm_resample_libsamplerate.c
@@ -42,7 +42,7 @@ void pcm_resample_deinit(struct pcm_resample_state *state)
static int pcm_resample_get_converter(void)
{
- const char *conf = getConfigParamValue(CONF_SAMPLERATE_CONVERTER);
+ const char *conf = config_get_string(CONF_SAMPLERATE_CONVERTER, NULL);
long convalgo;
char *test;
const char *test2;
diff --git a/src/tag_id3.c b/src/tag_id3.c
index 3bcdd9e58..9b5a3eae0 100644
--- a/src/tag_id3.c
+++ b/src/tag_id3.c
@@ -55,13 +55,13 @@ static id3_utf8_t * processID3FieldString (int is_id3v1, const id3_ucs4_t *ucs4,
{
id3_utf8_t *utf8, *utf8_stripped;
id3_latin1_t *isostr;
- char *encoding;
+ const char *encoding;
if (type == TAG_ITEM_GENRE)
ucs4 = id3_genre_name(ucs4);
/* use encoding field here? */
if (is_id3v1 &&
- (encoding = getConfigParamValue(CONF_ID3V1_ENCODING))) {
+ (encoding = config_get_string(CONF_ID3V1_ENCODING, NULL)) != NULL) {
isostr = id3_ucs4_latin1duplicate(ucs4);
if (G_UNLIKELY(!isostr)) {
return NULL;