From 76cc1ea613e038ced4bc6ae26233cb0681b63be5 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Fri, 28 Sep 2018 13:03:38 +0530 Subject: libglusterfs/dict: Add sizeof()-1 variants of dict functions One needs to be very careful about giving same key for the key and SLEN(key) arguments in dict_xxxn() functions. Writing macros that would take care of passing the SLEN(key) would help reduce this burden on the developer and reviewer. updates: bz#1193929 Change-Id: I312c479b919826570b47ae2c219c53e2f9b2ddef Signed-off-by: Pranith Kumar K --- xlators/mgmt/glusterd/src/glusterd-op-sm.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index c8343fb0a2d..3ccc9a3c776 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -2122,7 +2122,7 @@ _delete_reconfig_opt(dict_t *this, char *key, data_t *value, void *data) * option is going to be reset * */ if (!strncmp(key, VKEY_FEATURES_BITROT, strlen(VKEY_FEATURES_BITROT))) { - dict_deln(this, VKEY_FEATURES_SCRUB, SLEN(VKEY_FEATURES_SCRUB)); + dict_del_sizen(this, VKEY_FEATURES_SCRUB); } out: return 0; @@ -3244,10 +3244,8 @@ glusterd_remove_profile_volume_options(glusterd_volinfo_t *volinfo) { GF_ASSERT(volinfo); - dict_deln(volinfo->dict, VKEY_DIAG_LAT_MEASUREMENT, - SLEN(VKEY_DIAG_LAT_MEASUREMENT)); - dict_deln(volinfo->dict, VKEY_DIAG_CNT_FOP_HITS, - SLEN(VKEY_DIAG_CNT_FOP_HITS)); + dict_del_sizen(volinfo->dict, VKEY_DIAG_LAT_MEASUREMENT); + dict_del_sizen(volinfo->dict, VKEY_DIAG_CNT_FOP_HITS); } static int -- cgit