libidav/config.c

changeset 854
1c8401ece69e
parent 852
83fdf679df99
equal deleted inserted replaced
853:2ad93ebdc8d9 854:1c8401ece69e
1000 return NULL; 1000 return NULL;
1001 } 1001 }
1002 1002
1003 int dav_config_register_keys(DavConfig *config, DavContext *ctx, dav_loadkeyfile_func loadkey) { 1003 int dav_config_register_keys(DavConfig *config, DavContext *ctx, dav_loadkeyfile_func loadkey) {
1004 for(DavCfgKey *key=config->keys;key;key=key->next) { 1004 for(DavCfgKey *key=config->keys;key;key=key->next) {
1005 char *file = cx_strdup_m(key->file.value).ptr; 1005 char *file = cx_strdup_a(cxDefaultAllocator, key->file.value).ptr;
1006 cxmutstr keycontent = loadkey(file); 1006 cxmutstr keycontent = loadkey(file);
1007 free(file); 1007 free(file);
1008 1008
1009 // TODO: check key length 1009 // TODO: check key length
1010 1010
1011 if(!keycontent.ptr) { 1011 if(!keycontent.ptr) {
1012 return 1; 1012 return 1;
1013 } 1013 }
1014 1014
1015 DavKey *davkey = calloc(1, sizeof(DavKey)); 1015 DavKey *davkey = calloc(1, sizeof(DavKey));
1016 davkey->name = cx_strdup_m(key->name.value).ptr; 1016 davkey->name = cx_strdup_a(cxDefaultAllocator, key->name.value).ptr;
1017 davkey->type = dav_config_keytype(key->type); 1017 davkey->type = dav_config_keytype(key->type);
1018 davkey->data = keycontent.ptr; 1018 davkey->data = keycontent.ptr;
1019 davkey->length = keycontent.length; 1019 davkey->length = keycontent.length;
1020 1020
1021 dav_context_add_key(ctx, davkey); 1021 dav_context_add_key(ctx, davkey);

mercurial