diff options
| -rw-r--r-- | libglusterfs/src/dict.c | 23 | ||||
| -rw-r--r-- | libglusterfs/src/dict.h | 2 | 
2 files changed, 25 insertions, 0 deletions
diff --git a/libglusterfs/src/dict.c b/libglusterfs/src/dict.c index 5a07ba6b7..35a6c94f0 100644 --- a/libglusterfs/src/dict.c +++ b/libglusterfs/src/dict.c @@ -1230,6 +1230,15 @@ _copy (dict_t *unused,          dict_set ((dict_t *)newdict, key, (value));  } +static void +_remove (dict_t *dict, +         char *key, +         data_t *value, +         void *unused) +{ +        dict_del ((dict_t *)dict, key); +} +  dict_t *  dict_copy (dict_t *dict, @@ -1248,6 +1257,20 @@ dict_copy (dict_t *dict,          return new;  } +int +dict_reset (dict_t *dict) +{ +        int32_t         ret = -1; +        if (!dict) { +                gf_log_callingfn ("dict", GF_LOG_WARNING, "dict is NULL"); +                goto out; +        } +        dict_foreach (dict, _remove, NULL); +        ret = 0; +out: +        return ret; +} +  dict_t *  dict_copy_with_ref (dict_t *dict,                      dict_t *new) diff --git a/libglusterfs/src/dict.h b/libglusterfs/src/dict.h index e56c1b9a8..462397885 100644 --- a/libglusterfs/src/dict.h +++ b/libglusterfs/src/dict.h @@ -146,6 +146,8 @@ dict_t *dict_copy (dict_t *this, dict_t *new);  GF_MUST_CHECK dict_t *dict_new (void);  dict_t *dict_copy_with_ref (dict_t *this, dict_t *new); +GF_MUST_CHECK int dict_reset (dict_t *dict); +  GF_MUST_CHECK int dict_get_int8 (dict_t *this, char *key, int8_t *val);  GF_MUST_CHECK int dict_set_int8 (dict_t *this, char *key, int8_t val);  | 
