conf: replaced getConfigParamValue() with config_get_string()
Don't return a writable pointer.
This commit is contained in:
parent
7acc62366c
commit
0b29a22c08
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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 "
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user