aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/alcConfig.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-05-17 10:15:53 -0700
committerChris Robinson <[email protected]>2011-05-17 10:15:53 -0700
commitf7936b47091fc4effa92ea4a67c9624c64305e80 (patch)
treec1f28007b5ab1efdb2c4e5ff48990e3d0cbc0fd1 /Alc/alcConfig.c
parent60965e3a6c0bcf719a3dc266beccda4c4f560a72 (diff)
Avoid multiple getenv calls to the same var
Diffstat (limited to 'Alc/alcConfig.c')
-rw-r--r--Alc/alcConfig.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/Alc/alcConfig.c b/Alc/alcConfig.c
index 847e5d13..12eb4ff5 100644
--- a/Alc/alcConfig.c
+++ b/Alc/alcConfig.c
@@ -206,6 +206,7 @@ static void LoadConfigFromFile(FILE *f)
void ReadALConfig(void)
{
+ const char *str;
FILE *f;
cfgBlocks = calloc(1, sizeof(ConfigBlock));
@@ -231,9 +232,9 @@ void ReadALConfig(void)
LoadConfigFromFile(f);
fclose(f);
}
- if(getenv("HOME") && *(getenv("HOME")))
+ if((str=getenv("HOME")) != NULL && *str)
{
- snprintf(buffer, sizeof(buffer), "%s/.alsoftrc", getenv("HOME"));
+ snprintf(buffer, sizeof(buffer), "%s/.alsoftrc", str);
f = fopen(buffer, "r");
if(f)
{
@@ -242,9 +243,9 @@ void ReadALConfig(void)
}
}
#endif
- if(getenv("ALSOFT_CONF"))
+ if((str=getenv("ALSOFT_CONF")) != NULL && *str)
{
- f = fopen(getenv("ALSOFT_CONF"), "r");
+ f = fopen(str, "r");
if(f)
{
LoadConfigFromFile(f);