From 8a4f0de2a6dc5d1a9cbc54bbe9aa25d7e38d4ae7 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Sat, 18 Jul 2015 12:55:39 +0200 Subject: dict: merge static/non-static dict_set_* variations Copy/pasting complete functions for setting one boolean is rather ugly, this can easily be solved with a helper function that gets the boolean as an extra parameter. Also removing dict_set_dynmstr() because there are no callers, and using GF_MALLOC() or GF_CALLOC() to allocate memory for strings is much more preferred. And, as Kaleb pointed out, prefixing functions with an underscore '_' is reserved for libc internals. Renaming the _dict_*() functions for that reason. Change-Id: I8e681954502f17e59c8f5e8a294d3db238d3e5f3 BUG: 1232304 Reported-by: Kaleb KEITHLEY Signed-off-by: Niels de Vos Reviewed-on: http://review.gluster.org/11716 Tested-by: Gluster Build System Tested-by: NetBSD Build System Reviewed-by: Jeff Darcy --- libglusterfs/src/dict.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'libglusterfs/src/dict.h') diff --git a/libglusterfs/src/dict.h b/libglusterfs/src/dict.h index 30c12bd3209..c5b82677e2e 100644 --- a/libglusterfs/src/dict.h +++ b/libglusterfs/src/dict.h @@ -63,7 +63,6 @@ typedef struct _data_pair data_pair_t; struct _data { unsigned char is_static:1; unsigned char is_const:1; - unsigned char is_stdalloc:1; int32_t len; char *data; int32_t refcount; @@ -142,9 +141,6 @@ uint32_t data_to_uint32 (data_t *data); uint16_t data_to_uint16 (data_t *data); uint8_t data_to_uint8 (data_t *data); -data_t *data_from_ptr (void *value); -data_t *data_from_static_ptr (void *value); - data_t *data_from_int64 (int64_t value); data_t *data_from_int32 (int32_t value); data_t *data_from_int16 (int16_t value); @@ -239,7 +235,6 @@ GF_MUST_CHECK int dict_set_bin (dict_t *this, char *key, void *ptr, size_t size) GF_MUST_CHECK int dict_set_static_bin (dict_t *this, char *key, void *ptr, size_t size); GF_MUST_CHECK int dict_set_str (dict_t *this, char *key, char *str); -GF_MUST_CHECK int dict_set_dynmstr (dict_t *this, char *key, char *str); GF_MUST_CHECK int dict_set_dynstr (dict_t *this, char *key, 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); -- cgit