]> code.citadel.org Git - citadel.git/blobdiff - citadel/server/config.c
cdb_fetch() and cdb_next_item() now return a struct cdbdata instead of a pointer...
[citadel.git] / citadel / server / config.c
index 670e6e224b30a73a72fa82eac83b9d9fcd40dcf7..fc3d49ce75da654b7a91c2554db6600e6ef64d72 100644 (file)
@@ -362,7 +362,7 @@ void CtdlDelConfig(char *key) {
 // 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);
@@ -374,13 +374,12 @@ char *CtdlGetConfigStr(char *key) {
 
        // 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;
 }