If key not found, strdup default value, too

This commit is contained in:
Martin Willi
2011-04-21 10:57:17 +02:00
parent 3e2419ebe3
commit fdead26ffe
+1 -5
View File
@@ -453,15 +453,11 @@ METHOD(settings_t, alloc_str, char*,
va_start(args, def); va_start(args, def);
/* additional lock to savely strdup */ /* additional lock to savely strdup */
this->lock->read_lock(this->lock); this->lock->read_lock(this->lock);
value = strdupnull(find_value(this, this->top, key, args)); value = strdupnull(find_value(this, this->top, key, args) ?: def);
this->lock->unlock(this->lock); this->lock->unlock(this->lock);
va_end(args); va_end(args);
if (value)
{
return value; return value;
} }
return def;
}
/** /**
* Described in header * Described in header