本文整理汇总了C++中dpl_dict_free函数的典型用法代码示例。如果您正苦于以下问题:C++ dpl_dict_free函数的具体用法?C++ dpl_dict_free怎么用?C++ dpl_dict_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dpl_dict_free函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: dpl_cdmi_head
dpl_status_t
dpl_cdmi_head(dpl_ctx_t *ctx,
const char *bucket,
const char *resource,
const char *subresource,
const dpl_option_t *option,
dpl_ftype_t object_type,
const dpl_condition_t *condition,
dpl_dict_t **metadatap,
dpl_sysmd_t *sysmdp,
char **locationp)
{
int ret, ret2;
dpl_dict_t *all_mds = NULL;
dpl_dict_t *metadata = NULL;
DPL_TRACE(ctx, DPL_TRACE_BACKEND, "");
ret2 = dpl_cdmi_head_raw(ctx, bucket, resource, subresource, option, object_type, condition, &all_mds, locationp);
if (DPL_SUCCESS != ret2)
{
ret = ret2;
goto end;
}
ret2 = dpl_cdmi_get_metadata_from_values(all_mds, &metadata, sysmdp);
if (DPL_SUCCESS != ret2)
{
ret = ret2;
goto end;
}
if (NULL != metadatap)
{
*metadatap = metadata;
metadata = NULL;
}
ret = DPL_SUCCESS;
end:
if (NULL != metadata)
dpl_dict_free(metadata);
if (NULL != all_mds)
dpl_dict_free(all_mds);
DPL_TRACE(ctx, DPL_TRACE_BACKEND, "ret=%d", ret);
return ret;
}
开发者ID:gnb,项目名称:Droplet,代码行数:52,代码来源:backend.c
示例2: dpl_cdmi_head
dpl_status_t
dpl_cdmi_head(dpl_ctx_t *ctx,
const char *bucket,
const char *resource,
const char *subresource,
dpl_ftype_t object_type,
const dpl_condition_t *condition,
dpl_dict_t **metadatap)
{
int ret, ret2;
dpl_dict_t *all_mds = NULL;
dpl_dict_t *metadata = NULL;
ret2 = dpl_cdmi_head_all(ctx, bucket, resource, subresource, object_type, condition, &all_mds);
if (DPL_SUCCESS != ret2)
{
ret = ret2;
goto end;
}
metadata = dpl_dict_new(13);
if (NULL == metadata)
{
ret = DPL_ENOMEM;
goto end;
}
ret2 = dpl_cdmi_get_metadata_from_json_metadata(all_mds, metadata);
if (DPL_SUCCESS != ret2)
{
ret = DPL_FAILURE;
goto end;
}
if (NULL != metadatap)
{
*metadatap = metadata;
metadata = NULL;
}
ret = DPL_SUCCESS;
end:
if (NULL != metadata)
dpl_dict_free(metadata);
if (NULL != all_mds)
dpl_dict_free(all_mds);
return ret;
}
开发者ID:cvedel,项目名称:Droplet,代码行数:52,代码来源:backend.c
示例3: dpl_s3_delete_all
dpl_status_t
dpl_s3_delete_all(dpl_ctx_t *ctx,
const char *bucket,
dpl_locators_t *locators,
UNUSED const dpl_option_t *option,
UNUSED const dpl_condition_t *condition,
dpl_vec_t **objectsp)
{
dpl_status_t ret;
struct dall_req dctx = {
.req = NULL,
.headers = NULL,
.conn = NULL,
.data = NULL,
.answer_data = NULL,
.answer_len = 0,
.connection_close = 0,
.objects = NULL,
};
ret = delete_all(ctx, bucket, locators, &dctx, objectsp);
if (dctx.conn != NULL) {
if (dctx.connection_close)
dpl_conn_terminate(dctx.conn);
else
dpl_conn_release(dctx.conn);
}
if (dctx.headers != NULL)
dpl_dict_free(dctx.headers);
if (dctx.query_params)
dpl_dict_free(dctx.query_params);
if (dctx.req != NULL)
dpl_req_free(dctx.req);
if (dctx.data != NULL)
dpl_sbuf_free(dctx.data);
if (dctx.answer_data != NULL)
free(dctx.answer_data);
if (dctx.objects != NULL)
dpl_vec_delete_objects_free(dctx.objects);
return ret;
}
开发者ID:QuentinPerez,项目名称:Droplet,代码行数:49,代码来源:delete_all.c
示例4: dpl_posix_stream_getmd
dpl_status_t
dpl_posix_stream_getmd(dpl_ctx_t *ctx,
dpl_stream_t *stream,
dpl_dict_t **metadatap,
dpl_sysmd_t **sysmdp)
{
dpl_dict_t *all_mds = NULL;
dpl_status_t ret = DPL_FAILURE;
DPL_TRACE(ctx, DPL_TRACE_BACKEND, "");
ret = dpl_posix_head_raw(ctx, stream->bucket, stream->locator,
NULL, NULL, DPL_FTYPE_REG, NULL,
&all_mds, NULL);
if (DPL_SUCCESS != ret)
goto end;
ret = dpl_posix_get_metadata_from_values(all_mds,
metadatap,
sysmdp ? *sysmdp : NULL);
if (DPL_SUCCESS != ret)
goto end;
ret = DPL_SUCCESS;
end:
if (all_mds)
dpl_dict_free(all_mds);
DPL_TRACE(ctx, DPL_TRACE_BACKEND, "ret=%d", ret);
return ret;
}
开发者ID:bareos,项目名称:Droplet,代码行数:33,代码来源:backend.c
示例5: pentry_set_metadata
int
pentry_set_metadata(pentry_t *pe,
dpl_dict_t *dict)
{
int ret;
assert(pe);
if (pe->metadata)
dpl_dict_free(pe->metadata);
pe->metadata = dpl_dict_new(13);
if (! pe->metadata) {
LOG(LOG_ERR, "dpl_dict_new: can't allocate memory");
ret = -1;
goto err;
}
if (DPL_FAILURE == dpl_dict_copy(pe->metadata, dict)) {
ret = -1;
goto err;
}
ret = 0;
err:
return ret;
}
开发者ID:StefanKjartansson,项目名称:dropletfs-fuse,代码行数:27,代码来源:hash.c
示例6: pentry_set_usermd
int
pentry_set_usermd(tpath_entry *pe,
dpl_dict_t *dict)
{
int ret;
assert(pe);
if (pe->usermd)
dpl_dict_free(pe->usermd);
pe->usermd = dpl_dict_new(13);
if (! pe->usermd) {
LOG(LOG_ERR, "path=%s: dpl_dict_new: can't allocate memory",
pe->path);
ret = -1;
goto err;
}
if (DPL_FAILURE == dpl_dict_copy(pe->usermd, dict)) {
LOG(LOG_ERR, "path=%s: dpl_dict_copy: failed", pe->path);
ret = -1;
goto err;
}
ret = 0;
err:
return ret;
}
开发者ID:netconstructor,项目名称:dropletfs-fuse,代码行数:29,代码来源:hash.c
示例7: teardown
static void
teardown(void)
{
if (ctx)
dpl_ctx_free(ctx);
dpl_dict_free(profile);
toyserver_stop(state);
dpl_free();
}
开发者ID:gpryzby,项目名称:Droplet,代码行数:9,代码来源:sproxyd_utest.c
示例8: update_md
static void
update_md(gpointer data,
gpointer user_data)
{
pentry_t *pe = NULL;
char *path = NULL;
dpl_ftype_t type;
dpl_ino_t ino;
dpl_status_t rc;
dpl_dict_t *metadata = NULL;
struct list *dirent = NULL;
(void)user_data;
pe = data;
path = pentry_get_path(pe);
LOG(LOG_DEBUG, "path=%s", path);
ino = dpl_cwd(ctx, ctx->cur_bucket);
rc = dfs_namei_timeout(ctx, path, ctx->cur_bucket,
ino, NULL, NULL, &type);
LOG(LOG_DEBUG, "path=%s, dpl_namei: %s, type=%s",
path, dpl_status_str(rc), ftype_to_str(type));
if (DPL_SUCCESS != rc) {
LOG(LOG_NOTICE, "dfs_namei_timeout: %s", dpl_status_str(rc));
goto end;
}
rc = dfs_getattr_timeout(ctx, path, &metadata);
if (DPL_SUCCESS != rc && DPL_EISDIR != rc) {
LOG(LOG_ERR, "dfs_getattr_timeout: %s", dpl_status_str(rc));
goto end;
}
/* If this is a directory, update its entries' metadata */
if (DPL_FTYPE_DIR == type) {
dirent = pentry_get_dirents(pe);
if (dirent)
list_map(dirent, cb_map_dirents, pe);
}
if (pentry_md_trylock(pe))
goto end;
if (metadata)
pentry_set_metadata(pe, metadata);
pentry_set_atime(pe);
(void)pentry_md_unlock(pe);
end:
if (metadata)
dpl_dict_free(metadata);
}
开发者ID:StefanKjartansson,项目名称:dropletfs-fuse,代码行数:57,代码来源:cachedir.c
示例9: cmd_setattr
int
cmd_setattr(int argc,
char **argv)
{
int ret;
char opt;
char *path = NULL;
dpl_dict_t *metadata = NULL;
var_set("status", "1", VAR_CMD_SET, NULL);
optind = 0;
while ((opt = getopt(argc, argv, usage_getoptstr(setattr_usage))) != -1)
switch (opt)
{
case 'm':
metadata = dpl_parse_metadata(optarg);
if (NULL == metadata)
{
fprintf(stderr, "error parsing metadata\n");
return SHELL_CONT;
}
break ;
case '?':
default:
usage_help(&setattr_cmd);
return SHELL_CONT;
}
argc -= optind;
argv += optind;
if (1 != argc)
{
usage_help(&setattr_cmd);
return SHELL_CONT;
}
path = argv[0];
ret = dpl_setattr(ctx, path, metadata);
if (DPL_SUCCESS != ret)
{
fprintf(stderr, "status: %s (%d)\n", dpl_status_str(ret), ret);
goto end;
}
var_set("status", "0", VAR_CMD_SET, NULL);
end:
if (NULL != metadata)
dpl_dict_free(metadata);
return SHELL_CONT;
}
开发者ID:GiorgioRegni,项目名称:Droplet,代码行数:56,代码来源:cmd_setattr.c
示例10: dpl_profile_free
void
dpl_profile_free(dpl_ctx_t *ctx)
{
dpl_conn_pool_destroy(ctx);
dpl_close_event_log(ctx);
if (NULL != ctx->pricing)
dpl_pricing_free(ctx);
if (1 == ctx->use_https)
{
SSL_CTX_free(ctx->ssl_ctx);
BIO_vfree(ctx->ssl_bio_err);
}
/*
* profile
*/
if (NULL != ctx->addrlist)
dpl_addrlist_free(ctx->addrlist);
if (NULL != ctx->base_path)
free(ctx->base_path);
if (NULL != ctx->access_key)
free(ctx->access_key);
if (NULL != ctx->secret_key)
free(ctx->secret_key);
if (NULL != ctx->ssl_cert_file)
free(ctx->ssl_cert_file);
if (NULL != ctx->ssl_key_file)
free(ctx->ssl_key_file);
if (NULL != ctx->ssl_password)
free(ctx->ssl_password);
if (NULL != ctx->ssl_ca_list)
free(ctx->ssl_ca_list);
if (NULL != ctx->pricing)
free(ctx->pricing);
if (NULL != ctx->encrypt_key)
free(ctx->encrypt_key);
if (NULL != ctx->pricing_dir)
free(ctx->pricing_dir);
/**/
if (NULL != ctx->droplet_dir)
free(ctx->droplet_dir);
if (NULL != ctx->profile_name)
free(ctx->profile_name);
if (NULL != ctx->cwds)
dpl_dict_free(ctx->cwds);
if (NULL != ctx->cur_bucket)
free(ctx->cur_bucket);
}
开发者ID:pozdnychev,项目名称:Droplet,代码行数:55,代码来源:profile.c
示例11: START_TEST
END_TEST
START_TEST(remove_test)
{
dpl_dict_t *dict;
int i;
dpl_status_t r;
char valbuf[128];
/* create with a small table to ensure we have some chains */
dict = dpl_dict_new(5);
dpl_assert_ptr_not_null(dict);
/* add all the keys */
for (i = 0 ; i < nkeys ; i++)
{
dpl_dict_add(dict, keys[i],
make_value(i, valbuf, sizeof(valbuf)),
/* lowered */0);
}
dpl_assert_int_eq(nkeys, dpl_dict_count(dict));
/* remove the keys again */
for (i = 0 ; i < nkeys ; i++)
{
dpl_dict_var_t *var = dpl_dict_get(dict, keys[i]);
dpl_assert_ptr_not_null(var);
dpl_assert_str_eq(var->key, keys[i]);
dpl_dict_remove(dict, var);
dpl_assert_int_eq(nkeys-1-i, dpl_dict_count(dict));
}
/* add all the keys back again */
for (i = 0 ; i < nkeys ; i++)
{
dpl_dict_add(dict, keys[i],
make_value(i, valbuf, sizeof(valbuf)),
/* lowered */0);
}
dpl_assert_int_eq(nkeys, dpl_dict_count(dict));
/* remove the keys again in reverse order; we do
* this to exercise some hash chain manipulation
* corner cases */
for (i = nkeys-1 ; i >= 0 ; i--)
{
dpl_dict_var_t *var = dpl_dict_get(dict, keys[i]);
dpl_assert_ptr_not_null(var);
dpl_assert_str_eq(var->key, keys[i]);
dpl_dict_remove(dict, var);
dpl_assert_int_eq(i, dpl_dict_count(dict));
}
dpl_dict_free(dict);
}
开发者ID:QuentinPerez,项目名称:Droplet,代码行数:55,代码来源:dict_utest.c
示例12: cb_map_dirents
static void
cb_map_dirents(void *elem, void *cb_arg)
{
char *path = NULL;
dpl_dict_t *metadata = NULL;
dpl_status_t rc;
dpl_ftype_t type;
dpl_ino_t ino, parent_ino, obj_ino;
pentry_t *pe_dirent = NULL;
pentry_t *pe = NULL;
path = elem;
pe = cb_arg;
LOG(LOG_DEBUG, "path='%s', dirent='%s'", path, pentry_get_path(pe));
pe_dirent = g_hash_table_lookup(hash, path);
if (! pe_dirent) {
LOG(LOG_ERR, "'%s' is not an entry anymore in '%s'",
path, pentry_get_path(pe));
goto end;
}
rc = dfs_namei_timeout(ctx, path, ctx->cur_bucket,
ino, &parent_ino, &obj_ino, &type);
LOG(LOG_DEBUG, "path=%s, dpl_namei: %s, type=%s, parent_ino=%s, obj_ino=%s",
path, dpl_status_str(rc), ftype_to_str(type),
parent_ino.key, obj_ino.key);
if (DPL_SUCCESS != rc) {
LOG(LOG_NOTICE, "dfs_namei_timeout: %s", dpl_status_str(rc));
goto end;
}
rc = dfs_getattr_timeout(ctx, path, &metadata);
if (DPL_SUCCESS != rc && DPL_EISDIR != rc) {
LOG(LOG_ERR, "dfs_getattr_timeout: %s", dpl_status_str(rc));
goto end;
}
if (pentry_md_trylock(pe_dirent))
goto end;
if (metadata)
pentry_set_metadata(pe_dirent, metadata);
pentry_set_atime(pe_dirent);
(void)pentry_md_unlock(pe_dirent);
end:
if (metadata)
dpl_dict_free(metadata);
}
开发者ID:StefanKjartansson,项目名称:dropletfs-fuse,代码行数:55,代码来源:cachedir.c
示例13: dpl_cdmi_head_all
dpl_status_t
dpl_cdmi_head_all(dpl_ctx_t *ctx,
const char *bucket,
const char *resource,
const char *subresource,
dpl_ftype_t object_type,
const dpl_condition_t *condition,
dpl_dict_t **metadatap)
{
int ret, ret2;
char *md_buf = NULL;
u_int md_len;
dpl_dict_t *metadata = NULL;
//fetch metadata from JSON content
ret2 = dpl_cdmi_get(ctx, bucket, resource, NULL != subresource ? subresource : "metadata", object_type, condition, &md_buf, &md_len, NULL);
if (DPL_SUCCESS != ret2)
{
ret = DPL_FAILURE;
goto end;
}
metadata = dpl_dict_new(13);
if (NULL == metadata)
{
ret = DPL_ENOMEM;
goto end;
}
ret2 = dpl_cdmi_parse_metadata(ctx, md_buf, md_len, metadata);
if (DPL_SUCCESS != ret2)
{
ret = ret2;
goto end;
}
if (NULL != metadatap)
{
*metadatap = metadata;
metadata = NULL;
}
ret = DPL_SUCCESS;
end:
if (NULL != metadata)
dpl_dict_free(metadata);
if (NULL != md_buf)
free(md_buf);
return ret;
}
开发者ID:cvedel,项目名称:Droplet,代码行数:54,代码来源:backend.c
示例14: dpltest_upload_file
dpl_status_t
dpltest_upload_file(dpl_ctx_t *ctx,
char *path,
char *blob_buf,
int blob_size,
int buffered,
int block_size)
{
dpl_status_t ret, ret2;
dpl_canned_acl_t canned_acl = DPL_CANNED_ACL_PRIVATE;
dpl_dict_t *metadata = NULL;
int retries = 0;
dpl_sysmd_t sysmd;
memset(&sysmd, 0, sizeof (sysmd));
sysmd.mask = DPL_SYSMD_MASK_CANNED_ACL;
sysmd.canned_acl = canned_acl;
retry:
if (retries >= 3)
{
fprintf(stderr, "too many retries: %s (%d)\n", dpl_status_str(ret), ret);
ret = DPL_FAILURE;
goto end;
}
retries++;
//XXX buffered and block_size ignored for now
ret2 = dpl_fput(ctx, path, NULL, NULL, NULL, metadata, &sysmd, blob_buf, blob_size);
if (DPL_SUCCESS != ret2)
{
if (DPL_ENOENT == ret2)
{
ret = DPL_ENOENT;
}
goto retry;
}
ret = DPL_SUCCESS;
end:
if (NULL != metadata)
dpl_dict_free(metadata);
return ret;
}
开发者ID:scality,项目名称:Droplet-tests,代码行数:51,代码来源:file.c
示例15: dfs_readlink
int
dfs_readlink(const char *path,
char *buf,
size_t bufsiz)
{
dpl_dict_t *dict = NULL;
dpl_status_t rc;
int ret;
char *dest = NULL;
size_t dest_size = 0;
rc = dfs_getattr_timeout(ctx, path, &dict);
if (DPL_SUCCESS != rc) {
LOG(LOG_ERR, "dfs_getattr_timeout: %s", dpl_status_str(rc));
ret = -1;
goto err;
}
if (! dict) {
LOG(LOG_ERR, "dpl_getattr: %s", dpl_status_str(rc));
ret = -1;
goto err;
}
dest = dpl_dict_get_value(dict, "symlink");
if (! dest) {
LOG(LOG_ERR, "empty link path");
ret = -1;
goto err;
}
dest_size = strlen(dest);
if (dest_size > bufsiz) {
LOG(LOG_NOTICE, "link length too big: '%s'", dest);
dest_size = bufsiz;
}
if (! strncpy(buf, dest, dest_size)) {
LOG(LOG_ERR, "path=%s: strcpy: %s", path, strerror(errno));
ret = -1;
goto err;
}
ret = 0;
err:
if (dict)
dpl_dict_free(dict);
LOG(LOG_DEBUG, "%s", path);
return 0;
}
开发者ID:StefanKjartansson,项目名称:dropletfs-fuse,代码行数:51,代码来源:readlink.c
示例16: update_metadata_named_object
void
update_metadata_named_object()
{
dpl_async_task_t *atask = NULL;
dpl_status_t ret;
dpl_option_t option;
dpl_dict_t *metadata = NULL;
banner("6 - append metadata to existing named object");
metadata = dpl_dict_new(13);
if (NULL == metadata)
{
ret = DPL_ENOMEM;
exit(1);
}
ret = dpl_dict_add(metadata, "foo", "bar", 0);
if (DPL_SUCCESS != ret)
{
fprintf(stderr, "error updating metadatum: %s (%d)\n", dpl_status_str(ret), ret);
exit(1);
}
option.mask = DPL_OPTION_APPEND_METADATA;
atask = (dpl_async_task_t *) dpl_put_async_prepare(ctx,
NULL, //no bucket
file3_path, //the id
&option, //option
DPL_FTYPE_REG, //regular object
NULL, //condition
NULL, //range
metadata, //the metadata
NULL, //no sysmd
NULL); //object body
dpl_dict_free(metadata);
if (NULL == atask)
{
fprintf(stderr, "error preparing task\n");
exit(1);
}
atask->cb_func = cb_update_metadata_named_object;
atask->cb_arg = atask;
dpl_task_pool_put(pool, (dpl_task_t *) atask);
}
开发者ID:QuentinPerez,项目名称:Droplet,代码行数:50,代码来源:timo.c
示例17: dpl_s3_list_bucket_attrs
/* WARNING, UNTESTED */
dpl_status_t
dpl_s3_list_bucket_attrs(dpl_ctx_t *ctx,
const char *bucket,
const char *prefix,
const char *delimiter,
const int max_keys,
dpl_dict_t **metadatap,
dpl_sysmd_t *sysmdp,
dpl_vec_t **objectsp,
dpl_vec_t **common_prefixesp,
char **locationp)
{
dpl_status_t status;
status = dpl_s3_head(ctx,
bucket,
prefix,
NULL,
NULL,
DPL_FTYPE_UNDEF,
NULL,
metadatap,
sysmdp,
locationp);
if (DPL_SUCCESS != status)
{
goto end;
}
status = dpl_s3_list_bucket(ctx,
bucket,
prefix,
delimiter,
max_keys,
objectsp,
common_prefixesp,
locationp);
if (DPL_SUCCESS != status)
{
if (NULL != metadatap && NULL != *metadatap)
{
dpl_dict_free(*metadatap);
*metadatap = NULL;
}
goto end;
}
end:
return status;
}
开发者ID:QuentinPerez,项目名称:Droplet,代码行数:51,代码来源:list_bucket_attrs.c
示例18: dpl_posix_head
dpl_status_t
dpl_posix_head(dpl_ctx_t *ctx,
const char *bucket,
const char *resource,
const char *subresource,
const dpl_option_t *option,
dpl_ftype_t object_type,
const dpl_condition_t *condition,
dpl_dict_t **metadatap,
dpl_sysmd_t *sysmdp,
char **locationp)
{
dpl_status_t ret, ret2;
dpl_dict_t *all_mds = NULL;
char path[MAXPATHLEN];
DPL_TRACE(ctx, DPL_TRACE_BACKEND, "");
snprintf(path, sizeof (path), "/%s/%s",
ctx->base_path ? ctx->base_path : "",
resource ? resource : "");
ret2 = dpl_posix_head_raw(ctx, bucket, resource, subresource, option,
object_type, condition, &all_mds, locationp);
if (DPL_SUCCESS != ret2)
{
ret = ret2;
goto end;
}
ret2 = dpl_posix_get_metadata_from_values(all_mds, metadatap, sysmdp);
if (DPL_SUCCESS != ret2)
{
ret = ret2;
goto end;
}
ret = DPL_SUCCESS;
end:
if (NULL != all_mds)
dpl_dict_free(all_mds);
DPL_TRACE(ctx, DPL_TRACE_BACKEND, "ret=%d", ret);
return ret;
}
开发者ID:bareos,项目名称:Droplet,代码行数:48,代码来源:backend.c
示例19: dpl_cdmi_get_metadata_from_values
/**
* get metadata from values
*
* @param values
* @param metadatap
* @param sysmdp
*
* @return
*/
dpl_status_t
dpl_cdmi_get_metadata_from_values(const dpl_dict_t *values,
dpl_dict_t **metadatap,
dpl_sysmd_t *sysmdp)
{
dpl_dict_t *metadata = NULL;
dpl_status_t ret, ret2;
struct metadata_conven mc;
if (metadatap)
{
metadata = dpl_dict_new(13);
if (NULL == metadata)
{
ret = DPL_ENOMEM;
goto end;
}
}
memset(&mc, 0, sizeof (mc));
mc.metadata = metadata;
mc.sysmdp = sysmdp;
if (sysmdp)
sysmdp->mask = 0;
ret2 = dpl_dict_iterate(values, cb_values_iterate, &mc);
if (DPL_SUCCESS != ret2)
{
ret = ret2;
goto end;
}
if (NULL != metadatap)
{
*metadatap = metadata;
metadata = NULL;
}
ret = DPL_SUCCESS;
end:
if (NULL != metadata)
dpl_dict_free(metadata);
return ret;
}
开发者ID:bareos,项目名称:Droplet,代码行数:57,代码来源:replyparser.c
示例20: dpl_parse_query_params
/**
* parse a string of the form query_params1=value1;query_params2=value2...
*
* @param query_params
*
* @return
*/
dpl_dict_t *
dpl_parse_query_params(char *query_params)
{
char *saveptr = NULL;
char *str, *tok, *p;
int ret;
dpl_dict_t *dict;
char *nquery_params;
nquery_params = strdup(query_params);
if (NULL == nquery_params)
return NULL;
dict = dpl_dict_new(13);
if (NULL == dict)
{
free(nquery_params);
return NULL;
}
for (str = query_params;;str = NULL)
{
tok = strtok_r(str, ";", &saveptr);
if (NULL == tok)
break ;
DPRINTF("tok=%s\n", tok);
p = index(tok, '=');
if (NULL == p)
p = "";
else
*p++ = 0;
ret = dpl_dict_add(dict, tok, p, 0);
if (DPL_SUCCESS != ret)
{
dpl_dict_free(dict);
free(nquery_params);
return NULL;
}
}
free(nquery_params);
return dict;
}
开发者ID:GiorgioRegni,项目名称:Droplet,代码行数:54,代码来源:converters.c
注:本文中的dpl_dict_free函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论