From 73d53de1c9a9a2b536522d0d2e04031276941caf Mon Sep 17 00:00:00 2001 From: mquinson Date: Thu, 3 Jun 2004 22:16:04 +0000 Subject: [PATCH 1/1] API cleanup: s/dict_insert/dict_set/ and s/dict_retrieve/dict_get/ for consistency with dynar git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@92 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/gras/DataDesc/cbps.c | 14 ++++----- src/gras/DataDesc/ddt_exchange.c | 12 +++---- src/gras/Transport/transport.c | 10 +++--- src/xbt/config.c | 12 +++---- src/xbt/dict.c | 32 +++++++++---------- src/xbt/dict_cursor.c | 4 +-- src/xbt/dict_elm.c | 54 ++++++++++++++++---------------- src/xbt/dict_multi.c | 42 ++++++++++++------------- src/xbt/set.c | 16 +++++----- testsuite/xbt/dict_crash.c | 6 ++-- testsuite/xbt/dict_usage.c | 20 ++++++------ testsuite/xbt/multidict_crash.c | 10 +++--- 12 files changed, 116 insertions(+), 116 deletions(-) diff --git a/src/gras/DataDesc/cbps.c b/src/gras/DataDesc/cbps.c index 1c801fcd27..e09d63c6d0 100644 --- a/src/gras/DataDesc/cbps.c +++ b/src/gras/DataDesc/cbps.c @@ -65,11 +65,11 @@ gras_dd_cbps_push(gras_dd_cbps_t *ps, gras_dynar_t *p_dynar = NULL; gras_dd_cbps_elm_t *p_var = NULL; - gras_dict_retrieve(ps->space, name, (void **)&p_dynar); + gras_dict_get(ps->space, name, (void **)&p_dynar); if (!p_dynar) { gras_dynar_new(&p_dynar, sizeof (gras_dd_cbps_elm_t *), NULL); - gras_dict_insert(ps->space, name, (void **)p_dynar, NULL); + gras_dict_set(ps->space, name, (void **)p_dynar, NULL); /* FIXME: leaking on dynar. Insert in dict with a way to free it */ } @@ -100,7 +100,7 @@ gras_dd_cbps_pop (gras_dd_cbps_t *ps, void *data = NULL; /* FIXME: Error handling */ - gras_dict_retrieve(ps->space, name, (void **)&p_dynar); + gras_dict_get(ps->space, name, (void **)&p_dynar); gras_dynar_pop(p_dynar, &p_elm); if (!gras_dynar_length(p_dynar)) { @@ -158,11 +158,11 @@ gras_dd_cbps_set (gras_dd_cbps_t *ps, gras_dynar_t *p_dynar = NULL; gras_dd_cbps_elm_t *p_elm = NULL; - gras_dict_retrieve(ps->space, name, (void **)&p_dynar); + gras_dict_get(ps->space, name, (void **)&p_dynar); if (!p_dynar) { gras_dynar_new(&p_dynar, sizeof (gras_dd_cbps_elm_t *), NULL); - gras_dict_insert(ps->space, name, (void **)p_dynar, NULL); + gras_dict_set(ps->space, name, (void **)p_dynar, NULL); p_elm = calloc(1, sizeof(gras_dd_cbps_elm_t)); gras_dynar_push(ps->globals, &name); @@ -196,7 +196,7 @@ gras_dd_cbps_get (gras_dd_cbps_t *ps, gras_dd_cbps_elm_t *p_elm = NULL; /* FIXME: Error handling */ - gras_dict_retrieve(ps->space, name, (void **)&p_dynar); + gras_dict_get(ps->space, name, (void **)&p_dynar); gras_dynar_pop(p_dynar, &p_elm); gras_dynar_push(p_dynar, &p_elm); @@ -250,7 +250,7 @@ gras_dd_cbps_block_end(gras_dd_cbps_t *ps) { gras_dynar_t *p_dynar_elm = NULL; gras_dd_cbps_elm_t *p_elm = NULL; - gras_dict_retrieve(ps->space, name, (void **)&p_dynar_elm); + gras_dict_get(ps->space, name, (void **)&p_dynar_elm); gras_dynar_pop(p_dynar_elm, &p_elm); if (!gras_dynar_length(p_dynar_elm)) { diff --git a/src/gras/DataDesc/ddt_exchange.c b/src/gras/DataDesc/ddt_exchange.c index 41b3ac05d9..579f2ea738 100644 --- a/src/gras/DataDesc/ddt_exchange.c +++ b/src/gras/DataDesc/ddt_exchange.c @@ -124,7 +124,7 @@ gras_dd_alloc_ref(gras_dict_t *refs, DEBUG2("Insert %p under %p",*(void**)ptr, *(void**)r_ref); /* FIXME: Leaking on the ptr. Do I really need to copy it? */ - TRY(gras_dict_insert_ext(refs,(const char *) r_ref, r_len, ptr, NULL)); + TRY(gras_dict_set_ext(refs,(const char *) r_ref, r_len, ptr, NULL)); } return no_error; } @@ -366,10 +366,10 @@ gras_datadesc_send_rec(gras_socket_t *sock, VERB0("Not sending NULL referenced data"); break; } - errcode = gras_dict_retrieve_ext(refs,(char*)ref, sizeof(void*), &dummy); + errcode = gras_dict_get_ext(refs,(char*)ref, sizeof(void*), &dummy); if (errcode == mismatch_error) { VERB1("Sending data referenced at %p", *ref); - TRY(gras_dict_insert_ext(refs, (char*)ref, sizeof(void*), ref, NULL)); + TRY(gras_dict_set_ext(refs, (char*)ref, sizeof(void*), ref, NULL)); TRY(gras_datadesc_by_id(ref_code, &sub_type)); TRY(gras_datadesc_send_rec(sock,state,refs, sub_type, *ref)); @@ -578,9 +578,9 @@ gras_datadesc_recv_rec(gras_socket_t *sock, *(void**)l_data = NULL; break; } - errcode = gras_dict_retrieve_ext(refs, - (char*)r_ref, pointer_type->size[r_arch], - (void**)&l_ref); + errcode = gras_dict_get_ext(refs, + (char*)r_ref, pointer_type->size[r_arch], + (void**)&l_ref); if (errcode == mismatch_error) { diff --git a/src/gras/Transport/transport.c b/src/gras/Transport/transport.c index 45c05316b8..5970cdaeb9 100644 --- a/src/gras/Transport/transport.c +++ b/src/gras/Transport/transport.c @@ -40,13 +40,13 @@ gras_trp_init(void){ /* TCP */ TRY(gras_trp_tcp_init(&plug)); - TRY(gras_dict_insert(_gras_trp_plugins, - plug->name, plug, gras_trp_plugin_free)); + TRY(gras_dict_set(_gras_trp_plugins, + plug->name, plug, gras_trp_plugin_free)); /* FILE */ TRY(gras_trp_file_init(&plug)); - TRY(gras_dict_insert(_gras_trp_plugins, - plug->name, plug, gras_trp_plugin_free)); + TRY(gras_dict_set(_gras_trp_plugins, + plug->name, plug, gras_trp_plugin_free)); return no_error; } @@ -255,7 +255,7 @@ gras_error_t gras_trp_plugin_get_by_name(const char *name, gras_trp_plugin_t **dst){ - return gras_dict_retrieve(_gras_trp_plugins,name,(void**)dst); + return gras_dict_get(_gras_trp_plugins,name,(void**)dst); } int gras_socket_my_port (gras_socket_t *sock) { diff --git a/src/xbt/config.c b/src/xbt/config.c index b10cd74bdc..a74d572dcd 100644 --- a/src/xbt/config.c +++ b/src/xbt/config.c @@ -218,7 +218,7 @@ gras_cfg_register(gras_cfg_t *cfg, gras_cfgelm_t *res; gras_error_t errcode; - TRYCATCH(mismatch_error,gras_dict_retrieve((gras_dict_t*)cfg,name,(void**)&res)); + TRYCATCH(mismatch_error,gras_dict_get((gras_dict_t*)cfg,name,(void**)&res)); if (errcode != mismatch_error) { WARN1("Config elem %s registered twice.",name); @@ -254,7 +254,7 @@ gras_cfg_register(gras_cfg_t *cfg, ERROR1("%d is an invalide type code",type); } - return gras_dict_insert((gras_dict_t*)cfg,name,res,&gras_cfgelm_free); + return gras_dict_set((gras_dict_t*)cfg,name,res,&gras_cfgelm_free); } /** @@ -398,7 +398,7 @@ static gras_error_t gras_cfgelm_get(gras_cfg_t *cfg, /* OUT */ gras_cfgelm_t **whereto){ gras_error_t errcode; - TRYCATCH(mismatch_error,gras_dict_retrieve((gras_dict_t*)cfg,name,(void**)whereto)); + TRYCATCH(mismatch_error,gras_dict_get((gras_dict_t*)cfg,name,(void**)whereto)); if (errcode == mismatch_error) { ERROR1("No registered cell %s in this config set", @@ -432,7 +432,7 @@ gras_cfg_get_type(gras_cfg_t *cfg, const char *name, gras_cfgelm_t *cell; gras_error_t errcode; - TRYCATCH(mismatch_error,gras_dict_retrieve((gras_dict_t*)cfg,name,(void**)&cell)); + TRYCATCH(mismatch_error,gras_dict_get((gras_dict_t*)cfg,name,(void**)&cell)); if (errcode == mismatch_error) { ERROR1("Can't get the type of '%s' since this cell does not exist", @@ -596,7 +596,7 @@ gras_cfg_set_parse(gras_cfg_t *cfg, const char *options) { DEBUG2("name='%s';val='%s'",name,val); - errcode=gras_dict_retrieve((gras_dict_t*)cfg,name,(void**)&cell); + errcode=gras_dict_get((gras_dict_t*)cfg,name,(void**)&cell); switch (errcode) { case no_error: break; @@ -919,7 +919,7 @@ gras_cfg_empty(gras_cfg_t *cfg,const char*name) { gras_error_t errcode; TRYCATCH(mismatch_error, - gras_dict_retrieve((gras_dict_t*)cfg,name,(void**)&cell)); + gras_dict_get((gras_dict_t*)cfg,name,(void**)&cell)); if (errcode == mismatch_error) { ERROR1("Can't empty '%s' since this config element does not exist", name); diff --git a/src/xbt/dict.c b/src/xbt/dict.c index 6602cc0023..1e8ccdb009 100644 --- a/src/xbt/dict.c +++ b/src/xbt/dict.c @@ -63,18 +63,18 @@ gras_dict_free(gras_dict_t **dict) { } /** - * gras_dict_insert_ext: + * gras_dict_set_ext: * * @p_dict: the container - * @key: the key to insert the new data + * @key: the key to set the new data * @data: the data to add in the dict * @Returns: a gras_error * - * Insert the @data in the structure under the @key, which can be any kind + * set the @data in the structure under the @key, which can be any kind * of data, as long as its length is provided in @key_len. */ gras_error_t -gras_dict_insert_ext(gras_dict_t *p_dict, +gras_dict_set_ext(gras_dict_t *p_dict, const char *key, int key_len, void *data, @@ -82,34 +82,34 @@ gras_dict_insert_ext(gras_dict_t *p_dict, gras_assert(p_dict); - return gras_dictelm_insert_ext(&(p_dict->head), + return gras_dictelm_set_ext(&(p_dict->head), key, key_len, data, free_ctn); } /** - * gras_dict_insert: + * gras_dict_set: * * @head: the head of the dict - * @key: the key to insert the new data + * @key: the key to set the new data * @data: the data to add in the dict * @Returns: a gras_error * - * Insert the @data in the structure under the @key, which is a + * set the @data in the structure under the @key, which is a * null terminated string. */ gras_error_t -gras_dict_insert(gras_dict_t *p_dict, +gras_dict_set(gras_dict_t *p_dict, const char *key, void *data, void_f_pvoid_t *free_ctn) { gras_assert(p_dict); - return gras_dictelm_insert(&(p_dict->head), key, data, free_ctn); + return gras_dictelm_set(&(p_dict->head), key, data, free_ctn); } /** - * gras_dict_retrieve_ext: + * gras_dict_get_ext: * * @dict: the dealer of data * @key: the key to find data @@ -119,18 +119,18 @@ gras_dict_insert(gras_dict_t *p_dict, * Search the given @key. mismatch_error when not found. */ gras_error_t -gras_dict_retrieve_ext(gras_dict_t *dict, +gras_dict_get_ext(gras_dict_t *dict, const char *key, int key_len, /* OUT */void **data) { gras_assert(dict); - return gras_dictelm_retrieve_ext(dict->head, key, key_len, data); + return gras_dictelm_get_ext(dict->head, key, key_len, data); } /** - * gras_dict_retrieve: + * gras_dict_get: * * @dict: the dealer of data * @key: the key to find data @@ -140,12 +140,12 @@ gras_dict_retrieve_ext(gras_dict_t *dict, * Search the given @key. mismatch_error when not found. */ gras_error_t -gras_dict_retrieve(gras_dict_t *dict, +gras_dict_get(gras_dict_t *dict, const char *key, /* OUT */void **data) { gras_assert(dict); - return gras_dictelm_retrieve(dict->head, key, data); + return gras_dictelm_get(dict->head, key, data); } diff --git a/src/xbt/dict_cursor.c b/src/xbt/dict_cursor.c index 62306966a9..2840c7accb 100644 --- a/src/xbt/dict_cursor.c +++ b/src/xbt/dict_cursor.c @@ -226,7 +226,7 @@ gras_dict_cursor_get_or_free(gras_dict_cursor_t **cursor, gras_dynar_get((*cursor)->keys, (*cursor)->pos, key ); gras_dynar_get((*cursor)->key_lens, (*cursor)->pos_len, &key_len); - errcode = gras_dictelm_retrieve_ext((*cursor)->head, *key, key_len, data); + errcode = gras_dictelm_get_ext((*cursor)->head, *key, key_len, data); if (errcode == mismatch_error) { gras_dict_cursor_free(*cursor); *cursor=NULL; @@ -278,7 +278,7 @@ gras_dict_cursor_get_data(gras_dict_cursor_t *p_cursor, gras_dynar_get(p_cursor->keys, p_cursor->pos-1, &key ); gras_dynar_get(p_cursor->key_lens, p_cursor->pos_len-1, &key_len); - TRY(gras_dictelm_retrieve_ext(p_cursor->head, key, key_len, data)); + TRY(gras_dictelm_get_ext(p_cursor->head, key, key_len, data)); return errcode; } diff --git a/src/xbt/dict_elm.c b/src/xbt/dict_elm.c index 162f7dc47a..4711edea66 100644 --- a/src/xbt/dict_elm.c +++ b/src/xbt/dict_elm.c @@ -50,13 +50,13 @@ static gras_error_t _gras_dictelm_dump_rec(gras_dictelm_t *head, -static gras_error_t _gras_dictelm_insert_rec(gras_dictelm_t *head, +static gras_error_t _gras_dictelm_set_rec(gras_dictelm_t *head, char *key, int key_len, int offset, void *data, void_f_pvoid_t *free_ctn); -static gras_error_t _gras_dictelm_retrieve_rec(gras_dictelm_t *head, +static gras_error_t _gras_dictelm_get_rec(gras_dictelm_t *head, const char *key, int key_len, int offset, @@ -413,22 +413,22 @@ _gras_dictelm_change_value(gras_dictelm_t *p_elm, } /** - * _gras_dictelm_insert_rec: + * _gras_dictelm_set_rec: * * @head: the head of the dict - * @key: the key to insert the new data + * @key: the key to set the new data * @offset: offset on key. * @data: the data to add in the dict * @Returns: a gras_error * - * Insert the @data in the structure under the @key. The @key is destroyed + * set the @data in the structure under the @key. The @key is destroyed * in the process. Think to strdup it before. * - * This is a helper function to gras_dict_insert which locks the struct and + * This is a helper function to gras_dict_set which locks the struct and * strdup the key before action. */ gras_error_t -_gras_dictelm_insert_rec(gras_dictelm_t *p_head, +_gras_dictelm_set_rec(gras_dictelm_t *p_head, char *key, int key_len, int offset, @@ -495,7 +495,7 @@ _gras_dictelm_insert_rec(gras_dictelm_t *p_head, gras_dynar_get(p_head->sub, pos, &p_child); CDEBUG2(dict_add,"-> Recurse on %p (offset=%d)", p_child, offset); - return _gras_dictelm_insert_rec(p_child, key, key_len, + return _gras_dictelm_set_rec(p_child, key, key_len, offset, data, free_ctn); } @@ -557,18 +557,18 @@ _gras_dictelm_insert_rec(gras_dictelm_t *p_head, } /** - * gras_dictelm_insert_ext: + * gras_dictelm_set_ext: * * @head: the head of the dict - * @key: the key to insert the new data + * @key: the key to set the new data * @data: the data to add in the dict * @Returns: a gras_error * - * Insert the @data in the structure under the @key, which can be any kind + * set the @data in the structure under the @key, which can be any kind * of data, as long as its length is provided in @key_len. */ gras_error_t -gras_dictelm_insert_ext(gras_dictelm_t **pp_head, +gras_dictelm_set_ext(gras_dictelm_t **pp_head, const char *_key, int key_len, void *data, @@ -598,31 +598,31 @@ gras_dictelm_insert_ext(gras_dictelm_t **pp_head, return errcode; } - return _gras_dictelm_insert_rec(p_head, key, key_len, 0, data, free_ctn); + return _gras_dictelm_set_rec(p_head, key, key_len, 0, data, free_ctn); } /** - * gras_dictelm_insert: + * gras_dictelm_set: * * @head: the head of the dict - * @key: the key to insert the new data + * @key: the key to set the new data * @data: the data to add in the dict * @Returns: a gras_error * - * Insert the @data in the structure under the @key, which is a + * set the @data in the structure under the @key, which is a * null terminated string. */ gras_error_t -gras_dictelm_insert(gras_dictelm_t **pp_head, +gras_dictelm_set(gras_dictelm_t **pp_head, const char *_key, void *data, void_f_pvoid_t *free_ctn) { - return gras_dictelm_insert_ext(pp_head, _key, 1+strlen(_key), data, free_ctn); + return gras_dictelm_set_ext(pp_head, _key, 1+strlen(_key), data, free_ctn); } /** - * _gras_dict_retrieve_rec: + * _gras_dict_get_rec: * * @head: the head of the dict * @key: the key to find data @@ -634,7 +634,7 @@ gras_dictelm_insert(gras_dictelm_t **pp_head, */ static gras_error_t -_gras_dictelm_retrieve_rec(gras_dictelm_t *p_head, +_gras_dictelm_get_rec(gras_dictelm_t *p_head, const char *key, int key_len, int offset, @@ -683,7 +683,7 @@ _gras_dictelm_retrieve_rec(gras_dictelm_t *p_head, gras_dynar_get(p_head->sub, pos, &p_child); - return _gras_dictelm_retrieve_rec(p_child, key, key_len, offset, data); + return _gras_dictelm_get_rec(p_child, key, key_len, offset, data); } case 3: /* The key is a prefix of the child => not found */ @@ -699,7 +699,7 @@ _gras_dictelm_retrieve_rec(gras_dictelm_t *p_head, } /** - * gras_dictelm_retrieve_ext: + * gras_dictelm_get_ext: * * @head: the head of the dict * @key: the key to find data @@ -709,7 +709,7 @@ _gras_dictelm_retrieve_rec(gras_dictelm_t *p_head, * Search the given @key. mismatch_error when not found. */ gras_error_t -gras_dictelm_retrieve_ext(gras_dictelm_t *p_head, +gras_dictelm_get_ext(gras_dictelm_t *p_head, const char *key, int key_len, /* OUT */void **data) { @@ -718,11 +718,11 @@ gras_dictelm_retrieve_ext(gras_dictelm_t *p_head, return mismatch_error; } - return _gras_dictelm_retrieve_rec(p_head, key, key_len, 0, data); + return _gras_dictelm_get_rec(p_head, key, key_len, 0, data); } /** - * gras_dictelm_retrieve: + * gras_dictelm_get: * * @head: the head of the dict * @key: the key to find data @@ -732,11 +732,11 @@ gras_dictelm_retrieve_ext(gras_dictelm_t *p_head, * Search the given @key. mismatch_error when not found. */ gras_error_t -gras_dictelm_retrieve(gras_dictelm_t *p_head, +gras_dictelm_get(gras_dictelm_t *p_head, const char *key, /* OUT */void **data) { - return gras_dictelm_retrieve_ext(p_head, key, 1+strlen(key), data); + return gras_dictelm_get_ext(p_head, key, 1+strlen(key), data); } /*----[ _gras_dict_collapse ]------------------------------------------------*/ diff --git a/src/xbt/dict_multi.c b/src/xbt/dict_multi.c index 4cf5e999c7..b9a9d26faa 100644 --- a/src/xbt/dict_multi.c +++ b/src/xbt/dict_multi.c @@ -16,19 +16,19 @@ /*####[ Multi dict functions ]##############################################*/ /*###############################"##########################################*/ /** - * gras_mutidict_insert: + * gras_mutidict_set: * * @head: the head of dict * @keycount: the number of the key * @key: the key - * @data: the data to insert + * @data: the data to set * @Returns: gras_error_t * - * Insert the data in the structure under the @keycount @key. + * set the data in the structure under the @keycount @key. */ gras_error_t -gras_multidict_insert_ext(gras_dict_t **pp_head, +gras_multidict_set_ext(gras_dict_t **pp_head, int keycount, char **key, int *key_len, @@ -39,7 +39,7 @@ gras_multidict_insert_ext(gras_dict_t **pp_head, gras_dictelm_t *p_subdict = NULL; int i = 0; - CDEBUG2(dict_multi, "fast_multidict_insert(%p,%d). Keys:", *pp_head, keycount); + CDEBUG2(dict_multi, "fast_multidict_set(%p,%d). Keys:", *pp_head, keycount); /* for (i = 0; i < keycount; i++) { @@ -47,10 +47,10 @@ gras_multidict_insert_ext(gras_dict_t **pp_head, } */ - gras_assert0(keycount >= 1, "Can't insert less than one key in a multidict"); + gras_assert0(keycount >= 1, "Can't set less than one key in a multidict"); if (keycount == 1) - return gras_dict_insert_ext(pp_head, key[0], key_len[0], data, free_ctn); + return gras_dict_set_ext(pp_head, key[0], key_len[0], data, free_ctn); if (!*pp_head) { TRY(_gras_dict_alloc(NULL, 0, 0, NULL, NULL, pp_head)); @@ -61,23 +61,23 @@ gras_multidict_insert_ext(gras_dict_t **pp_head, for (i = 0; i < keycount-1; i++) { /* search the dict of next level */ - TRYCATCH(gras_dict_retrieve(p_elm, key[i], (void*)&p_subdict), mismatch_error); + TRYCATCH(gras_dict_get(p_elm, key[i], (void*)&p_subdict), mismatch_error); /* make sure the dict of next level exists */ if (errcode == mismatch_error) { TRY(_gras_dict_alloc(NULL, 0, 0, NULL, NULL, &p_subdict)); - TRY(gras_dict_insert_ext(&p_elm, key[i], key_len[i], &p_subdict, + TRY(gras_dict_set_ext(&p_elm, key[i], key_len[i], &p_subdict, _free_dict)); } p_elm = p_subdict; } - return gras_dict_insert_ext(&p_elm, key[i], key_len[i], data, free_ctn); + return gras_dict_set_ext(&p_elm, key[i], key_len[i], data, free_ctn); } gras_error_t -gras_multidict_insert(gras_dictelm_t **pp_head, +gras_multidict_set(gras_dictelm_t **pp_head, int keycount, char **key, void *data, @@ -94,7 +94,7 @@ gras_multidict_insert(gras_dictelm_t **pp_head, key_len[i] = 1+strlen(key[i]); } - TRYCLEAN(gras_multidict_insert_ext(pp_head, keycount, key, key_len, data, free_ctn), + TRYCLEAN(gras_multidict_set_ext(pp_head, keycount, key, key_len, data, free_ctn), free(key_len)); free(key_len); @@ -103,12 +103,12 @@ gras_multidict_insert(gras_dictelm_t **pp_head, } /** - * gras_mutidict_retrieve: + * gras_mutidict_get: * * @head: the head of dict * @keycount: the number of the key * @key: the key - * @data: where to put the data retrieved + * @data: where to put the got data * @Returns: gras_error_t * * Search the given @key. data=NULL when not found @@ -116,7 +116,7 @@ gras_multidict_insert(gras_dictelm_t **pp_head, gras_error_t -gras_multidict_retrieve_ext(gras_dictelm_t *p_head, +gras_multidict_get_ext(gras_dictelm_t *p_head, int keycount, const char **key, int *key_len, @@ -125,7 +125,7 @@ gras_multidict_retrieve_ext(gras_dictelm_t *p_head, gras_dictelm_t *p_elm = p_head; int i = 0; - CDEBUG2(dict_multi, "fast_multidict_retrieve(%p, %d). Keys:", p_head, keycount); + CDEBUG2(dict_multi, "fast_multidict_get(%p, %d). Keys:", p_head, keycount); /* for (i = 0; i < keycount; i++) { @@ -137,7 +137,7 @@ gras_multidict_retrieve_ext(gras_dictelm_t *p_head, while (p_elm && i < keycount-1) { - TRY(gras_dict_retrieve_ext(p_elm, key[i], key_len[i], (void**)p_elm)); + TRY(gras_dict_get_ext(p_elm, key[i], key_len[i], (void**)p_elm)); /* if (p_elm) { @@ -153,7 +153,7 @@ gras_multidict_retrieve_ext(gras_dictelm_t *p_head, if (p_elm) { // Found all dicts to the data // gras_dict_dump(dict,&gras_dict_prints); - return gras_dict_retrieve_ext(p_elm, key[i], key_len[i], data); + return gras_dict_get_ext(p_elm, key[i], key_len[i], data); } else { @@ -165,7 +165,7 @@ gras_multidict_retrieve_ext(gras_dictelm_t *p_head, } gras_error_t -gras_multidict_retrieve(gras_dictelm_t *p_head, +gras_multidict_get(gras_dictelm_t *p_head, int keycount, const char **key, /* OUT */void **data) { @@ -181,7 +181,7 @@ gras_multidict_retrieve(gras_dictelm_t *p_head, key_len[i] = 1+strlen(key[i]); } - TRYCLEAN(gras_multidict_retrieve_ext(p_head, keycount, key, key_len, data), + TRYCLEAN(gras_multidict_get_ext(p_head, keycount, key, key_len, data), free(key_len)); free(key_len); @@ -210,7 +210,7 @@ gras_multidict_remove_ext(gras_dictelm_t *p_head, int i = 0; while (p_elm && i < keycount-1) { - if (!gras_dict_retrieve_ext(p_elm, key[i], key_len[i], (void**)&p_elm)) { + if (!gras_dict_get_ext(p_elm, key[i], key_len[i], (void**)&p_elm)) { return 0; } } diff --git a/src/xbt/set.c b/src/xbt/set.c index 94280a1ee7..1827c30cb0 100644 --- a/src/xbt/set.c +++ b/src/xbt/set.c @@ -77,13 +77,13 @@ gras_error_t gras_set_add (gras_set_t *set, elm->name_len = strlen(elm->name); } - errcode = gras_dict_retrieve_ext (set->dict, + errcode = gras_dict_get_ext (set->dict, elm->name, elm->name_len, (void**) &found_in_dict); if (errcode == no_error) { elm->ID=found_in_dict->ID; DEBUG2("Reinsertion of key %s (id %d)", elm->name, elm->ID); - TRY(gras_dict_insert_ext(set->dict, elm->name, elm->name_len, elm, free_func)); + TRY(gras_dict_set_ext(set->dict, elm->name, elm->name_len, elm, free_func)); TRY(gras_dynar_set(set->dynar, elm->ID, &elm)); return no_error; @@ -92,7 +92,7 @@ gras_error_t gras_set_add (gras_set_t *set, } elm->ID = gras_dynar_length( set->dynar ); - TRY(gras_dict_insert_ext(set->dict, elm->name, elm->name_len, elm, free_func)); + TRY(gras_dict_set_ext(set->dict, elm->name, elm->name_len, elm, free_func)); TRY(gras_dynar_set(set->dynar, elm->ID, &elm)); DEBUG2("Insertion of key '%s' (id %d)", elm->name, elm->ID); @@ -105,13 +105,13 @@ gras_error_t gras_set_add (gras_set_t *set, * @name: Name of the searched cell * @dst: where to put the found data into * - * Retrieve a data stored in the cell by providing its name. + * get a data stored in the cell by providing its name. */ gras_error_t gras_set_get_by_name (gras_set_t *set, const char *name, /* OUT */gras_set_elm_t **dst) { - return gras_dict_retrieve_ext(set->dict, name, strlen(name), (void**) dst); + return gras_dict_get_ext(set->dict, name, strlen(name), (void**) dst); } /** * gras_set_get_by_name_ext: @@ -120,7 +120,7 @@ gras_error_t gras_set_get_by_name (gras_set_t *set, * @name_len: length of the name, when strlen cannot be trusted * @dst: where to put the found data into * - * Retrieve a data stored in the cell by providing its name (and the length + * get a data stored in the cell by providing its name (and the length * of the name, when strlen cannot be trusted because you don't use a char* * as name, you weird guy). */ @@ -129,7 +129,7 @@ gras_error_t gras_set_get_by_name_ext(gras_set_t *set, int name_len, /* OUT */gras_set_elm_t **dst) { - return gras_dict_retrieve_ext (set->dict, name, name_len, (void**)dst); + return gras_dict_get_ext (set->dict, name, name_len, (void**)dst); } /** @@ -139,7 +139,7 @@ gras_error_t gras_set_get_by_name_ext(gras_set_t *set, * @name_len: length of the name, when strlen cannot be trusted * @dst: where to put the found data into * - * Retrieve a data stored in the cell by providing its name (and the length + * get a data stored in the cell by providing its name (and the length * of the name, when strlen cannot be trusted because you don't use a char* * as name, you weird guy). */ diff --git a/testsuite/xbt/dict_crash.c b/testsuite/xbt/dict_crash.c index 82ddc2e411..7a9fec72fe 100644 --- a/testsuite/xbt/dict_crash.c +++ b/testsuite/xbt/dict_crash.c @@ -77,7 +77,7 @@ int main(int argc,char **argv) { key[k]=rand() % ('z' - 'a') + 'a'; key[k]='\0'; // printf("[%d %s]\n",j,key); - TRYFAIL(gras_dict_insert(head,key,key,&free)); + TRYFAIL(gras_dict_set(head,key,key,&free)); } nb=0; // gras_dict_dump(head,(void (*)(void*))&printf); @@ -105,7 +105,7 @@ int main(int argc,char **argv) { } sprintf(key,"%d",j); - TRYFAIL(gras_dict_insert(head,key,key,&free)); + TRYFAIL(gras_dict_set(head,key,key,&free)); } printf("\n Count the elements (retrieving the key and data for each): \n"); @@ -122,7 +122,7 @@ int main(int argc,char **argv) { for (j=0;j