summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/dict.h
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2018-09-03 13:55:01 +0300
committerAtin Mukherjee <amukherj@redhat.com>2018-09-09 01:53:59 +0000
commit09198e203ece6925791a8a3a6121c5f808e4e873 (patch)
tree152f83348592c21fa697aeb0fc606e824ab7c993 /libglusterfs/src/dict.h
parent44e4db05a953a6f231c62225b462470cacb16bd4 (diff)
Some (mgmt) xlators: use dict_{setn|getn|deln|get_int32n|set_int32n|set_strn}
In a previous patch (https://review.gluster.org/20769) we've added the key length to be passed to dict_* funcs, to remove the need to strlen() it. This patch moves some xlators to use it. - It also adds dict_get_int32n which was missing. - It also reduces the size of some key variables. They were set to 1024b or PATH_MAX, where sometimes 64 bytes were really enough. Please review carefully: 1. That I did not reduce some the size of the key variables too much. 2. That I did not mix up some keys. Compile-tested only! Change-Id: Ic729baf179f40e8d02bc2350491d4bb9b6934266 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'libglusterfs/src/dict.h')
-rw-r--r--libglusterfs/src/dict.h19
1 files changed, 14 insertions, 5 deletions
diff --git a/libglusterfs/src/dict.h b/libglusterfs/src/dict.h
index 009663aec2e..a8945d017b7 100644
--- a/libglusterfs/src/dict.h
+++ b/libglusterfs/src/dict.h
@@ -113,7 +113,8 @@ int32_t dict_setn (dict_t *this, char *key, const int keylen, data_t *value);
int32_t dict_add (dict_t *this, char *key, data_t *value);
int32_t dict_addn (dict_t *this, char *key, const int keylen, data_t *value);
int dict_get_with_ref (dict_t *this, char *key, data_t **data);
-int dict_get_with_refn (dict_t *this, char *key, const int keylen, data_t **data);
+int dict_get_with_refn (dict_t *this, char *key, const int keylen,
+ data_t **data);
data_t *dict_get (dict_t *this, char *key);
data_t *dict_getn (dict_t *this, char *key, const int keylen);
void dict_del (dict_t *this, char *key);
@@ -219,7 +220,11 @@ GF_MUST_CHECK int dict_get_int16 (dict_t *this, char *key, int16_t *val);
GF_MUST_CHECK int dict_set_int16 (dict_t *this, char *key, int16_t val);
GF_MUST_CHECK int dict_get_int32 (dict_t *this, char *key, int32_t *val);
+GF_MUST_CHECK int dict_get_int32n (dict_t *this, char *key, const int keylen,
+ int32_t *val);
GF_MUST_CHECK int dict_set_int32 (dict_t *this, char *key, int32_t val);
+GF_MUST_CHECK int dict_set_int32n (dict_t *this, char *key, const int keylen,
+ int32_t val);
GF_MUST_CHECK int dict_get_int64 (dict_t *this, char *key, int64_t *val);
GF_MUST_CHECK int dict_set_int64 (dict_t *this, char *key, int64_t val);
@@ -251,14 +256,18 @@ GF_MUST_CHECK int dict_set_static_bin (dict_t *this, char *key, void *ptr, size_
GF_MUST_CHECK int dict_set_option (dict_t *this, char *key, char *str);
GF_MUST_CHECK int dict_set_str (dict_t *this, char *key, char *str);
-GF_MUST_CHECK int dict_set_strn (dict_t *this, char *key, const int keylen, char *str);
-GF_MUST_CHECK int dict_set_nstrn (dict_t *this, char *key, const int keylen, char *str, const int vallen);
+GF_MUST_CHECK int dict_set_strn (dict_t *this, char *key, const int keylen,
+ char *str);
+GF_MUST_CHECK int dict_set_nstrn (dict_t *this, char *key, const int keylen,
+ char *str, const int vallen);
GF_MUST_CHECK int dict_set_dynstr (dict_t *this, char *key, char *str);
-GF_MUST_CHECK int dict_set_dynstrn (dict_t *this, char *key, const int keylen, char *str);
+GF_MUST_CHECK int dict_set_dynstrn (dict_t *this, char *key, const int keylen,
+ char *str);
GF_MUST_CHECK int dict_set_dynstr_with_alloc (dict_t *this, char *key, const char *str);
GF_MUST_CHECK int dict_add_dynstr_with_alloc (dict_t *this, char *key, char *str);
GF_MUST_CHECK int dict_get_str (dict_t *this, char *key, char **str);
-GF_MUST_CHECK int dict_get_strn (dict_t *this, char *key, const int keylen, char **str);
+GF_MUST_CHECK int dict_get_strn (dict_t *this, char *key, const int keylen,
+ char **str);
GF_MUST_CHECK int dict_get_str_boolean (dict_t *this, char *key, int default_val);
GF_MUST_CHECK int dict_rename_key (dict_t *this, char *key, char *replace_key);