A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Interface revolution: do not try to survive to malloc failure
[simgrid.git]
/
src
/
xbt
/
dict.c
diff --git
a/src/xbt/dict.c
b/src/xbt/dict.c
index 3657cb0b315876a8cdb571de4c8ed64ba6577e9f..3bf65c2836a9284fa57fff47fd0d9de4144b5993 100644
(file)
--- a/
src/xbt/dict.c
+++ b/
src/xbt/dict.c
@@
-32,18
+32,12
@@
GRAS_LOG_NEW_DEFAULT_SUBCATEGORY(dict,gros,
*
* Creates and initialize a new dictionnary
*/
*
* Creates and initialize a new dictionnary
*/
-gras_error_t
+void
gras_dict_new(gras_dict_t **whereto) {
gras_dict_new(gras_dict_t **whereto) {
- gras_dict_t *dict;
-
- if (!(dict = calloc(1, sizeof(gras_dict_t))))
- RAISE_MALLOC;
- dict->head=NULL;
+ (*whereto) = gras_new(gras_dict_t,1);
+ (*whereto)->head=NULL;
- *whereto = dict;
-
- return no_error;
}
/**
* gras_dict_free:
}
/**
* gras_dict_free:
@@
-74,17
+68,17
@@
gras_dict_free(gras_dict_t **dict) {
* 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.
*/
* 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
+void
gras_dict_set_ext(gras_dict_t *p_dict,
gras_dict_set_ext(gras_dict_t *p_dict,
-
const char *key,
-
int key_len,
-
void *data,
-
void_f_pvoid_t *free_ctn) {
+ const char *key,
+ int key_len,
+ void *data,
+ void_f_pvoid_t *free_ctn) {
gras_assert(p_dict);
gras_assert(p_dict);
-
return
gras_dictelm_set_ext(&(p_dict->head),
-
key, key_len, data, free_ctn);
+ gras_dictelm_set_ext(&(p_dict->head),
+ key, key_len, data, free_ctn);
}
/**
}
/**
@@
-98,7
+92,7
@@
gras_dict_set_ext(gras_dict_t *p_dict,
* set the @data in the structure under the @key, which is a
* null terminated string.
*/
* set the @data in the structure under the @key, which is a
* null terminated string.
*/
-gras_error_t
+void
gras_dict_set(gras_dict_t *p_dict,
const char *key,
void *data,
gras_dict_set(gras_dict_t *p_dict,
const char *key,
void *data,
@@
-106,7
+100,7
@@
gras_dict_set(gras_dict_t *p_dict,
gras_assert(p_dict);
gras_assert(p_dict);
-
return
gras_dictelm_set(&(p_dict->head), key, data, free_ctn);
+ gras_dictelm_set(&(p_dict->head), key, data, free_ctn);
}
/**
}
/**
@@
-198,11
+192,11
@@
gras_dict_remove(gras_dict_t *dict,
* function to output the data. If NULL, data won't be displayed.
*/
* function to output the data. If NULL, data won't be displayed.
*/
-gras_error_t
+void
gras_dict_dump(gras_dict_t *dict,
void_f_pvoid_t *output) {
printf("Dict %p:\n", (void*)dict);
gras_dict_dump(gras_dict_t *dict,
void_f_pvoid_t *output) {
printf("Dict %p:\n", (void*)dict);
-
return
gras_dictelm_dump(dict ? dict->head: NULL, output);
+ gras_dictelm_dump(dict ? dict->head: NULL, output);
}
}