// Fetch a system config value. Caller does *not* own the returned value and may not alter it.
char *CtdlGetConfigStr(char *key) {
char *value = NULL;
- struct cdbdata *cdb;
+ struct cdbdata cdb;
int key_len = strlen(key);
if (IsEmptyStr(key)) return(NULL);
// Then look in the database.
cdb = cdb_fetch(CDB_CONFIG, key, key_len);
- if (cdb == NULL) { // nope, not there either.
+ if (cdb.len <= 0) { // nope, not there either.
return(NULL);
}
// Got it. Save it in memory for the next fetch.
- value = strdup(cdb->ptr + key_len + 1); // The key was stored there too; skip past it
- cdb_free(cdb);
+ value = strdup(cdb.ptr + key_len + 1); // The key was stored there too; skip past it
Put(ctdlconfig, key, key_len, value, NULL);
return value;
}