From bc6b6f6a168804f22bbb44081f89e938fbfcec60 Mon Sep 17 00:00:00 2001 From: Yaniv Kaul Date: Thu, 30 Aug 2018 10:54:54 +0300 Subject: libglusterfs/src/dict.c: remove memcpy(), gf_asprintf -> asprintf 1. We don't need a temp. string to strotol(), we can use data->data. 2. We don't need the gf_asprintf, when a regular asprintf would do. 3. No need to CALLOC the data, can MALLOC, since we are going to populate most of the fields anyway. 4. Removed is_const member - it was not used. 5. Turned is_static to a gf_boolean_t 6. Turned another get_mem0 to get_mem (in dict_set_lk() func) 7. Remove dict_set_ptr - was exactly the same as dict_set_static_ptr (apart from the 'static' bit) and no one was using it. 8. Removed is_static from the dictionary object. Did not seem to be very useful. Compile-tested only! updates: bz#1193929 Signed-off-by: Yaniv Kaul Change-Id: I7b1f6320867b154be4a94033819407f7e51cf38c --- libglusterfs/src/dict.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'libglusterfs/src/dict.h') diff --git a/libglusterfs/src/dict.h b/libglusterfs/src/dict.h index 83cfd9c0827..009663aec2e 100644 --- a/libglusterfs/src/dict.h +++ b/libglusterfs/src/dict.h @@ -73,8 +73,7 @@ struct _data { gf_lock_t lock; gf_dict_data_type_t data_type; int32_t len; - unsigned char is_static:1; - unsigned char is_const:1; + gf_boolean_t is_static; }; struct _data_pair { @@ -99,7 +98,6 @@ struct _dict { data_pair_t *members_internal; data_pair_t free_pair; gf_boolean_t free_pair_in_use; - unsigned char is_static:1; }; typedef gf_boolean_t (*dict_match_t) (dict_t *d, char *k, data_t *v, @@ -245,7 +243,6 @@ GF_MUST_CHECK int dict_set_double (dict_t *this, char *key, double val); GF_MUST_CHECK int dict_set_static_ptr (dict_t *this, char *key, void *ptr); GF_MUST_CHECK int dict_get_ptr (dict_t *this, char *key, void **ptr); GF_MUST_CHECK int dict_get_ptr_and_len (dict_t *this, char *key, void **ptr, int *len); -GF_MUST_CHECK int dict_set_ptr (dict_t *this, char *key, void *ptr); GF_MUST_CHECK int dict_set_dynptr (dict_t *this, char *key, void *ptr, size_t size); GF_MUST_CHECK int dict_get_bin (dict_t *this, char *key, void **ptr); -- cgit