From edb386eb1edaed1661089064bab57c8d39c52a15 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 19 Sep 2011 11:29:18 -0700 Subject: Add a ConfigValueStr function, to return the string through a parameter --- Alc/panning.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'Alc/panning.c') diff --git a/Alc/panning.c b/Alc/panning.c index b225e3ec..983d3ef6 100644 --- a/Alc/panning.c +++ b/Alc/panning.c @@ -34,21 +34,17 @@ static void SetSpeakerArrangement(const char *name, ALfloat SpeakerAngle[MAXCHANNELS], enum Channel Speaker2Chan[MAXCHANNELS], ALint chans) { - char layout_str[256]; char *confkey, *next; + char *layout_str; char *sep, *end; enum Channel val; + const char *str; int i; - if(!ConfigValueExists(NULL, name)) - name = "layout"; - - strncpy(layout_str, GetConfigValue(NULL, name, ""), sizeof(layout_str)); - layout_str[sizeof(layout_str)-1] = 0; - - if(!layout_str[0]) + if(!ConfigValueStr(NULL, name, &str) && !ConfigValueStr(NULL, "layout", &str)) return; + layout_str = strdup(str); next = confkey = layout_str; while(next && *next) { @@ -113,6 +109,8 @@ static void SetSpeakerArrangement(const char *name, ALfloat SpeakerAngle[MAXCHAN } } } + free(layout_str); + layout_str = NULL; for(i = 0;i < chans;i++) { -- cgit v1.2.3