diff options
author | Yaniv Kaul <ykaul@redhat.com> | 2018-08-30 10:54:54 +0300 |
---|---|---|
committer | Yaniv Kaul <ykaul@redhat.com> | 2018-09-06 06:49:44 +0000 |
commit | bc6b6f6a168804f22bbb44081f89e938fbfcec60 (patch) | |
tree | c7d6c2ce954d7f0a21025e4239a9bb07ce49d211 /libglusterfs/src/dict.h | |
parent | e6a826a97def94458d6e02101c5bbb2b13833374 (diff) |
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 <ykaul@redhat.com>
Change-Id: I7b1f6320867b154be4a94033819407f7e51cf38c
Diffstat (limited to 'libglusterfs/src/dict.h')
-rw-r--r-- | libglusterfs/src/dict.h | 5 |
1 files changed, 1 insertions, 4 deletions
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); |