summaryrefslogtreecommitdiffstats
path: root/xlators/features/quota/src/quotad-aggregator.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2018-09-28 13:03:38 +0530
committerAmar Tumballi <amarts@redhat.com>2018-10-15 04:05:30 +0000
commit76cc1ea613e038ced4bc6ae26233cb0681b63be5 (patch)
treeecca8321697c25951dbe94bb4b7d182040d567ac /xlators/features/quota/src/quotad-aggregator.c
parentc962e2cbd73e78f31e690f7b1f8456616006c543 (diff)
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 <pkarampu@redhat.com>
Diffstat (limited to 'xlators/features/quota/src/quotad-aggregator.c')
-rw-r--r--xlators/features/quota/src/quotad-aggregator.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/xlators/features/quota/src/quotad-aggregator.c b/xlators/features/quota/src/quotad-aggregator.c
index 288955034bd..e0129e4f63a 100644
--- a/xlators/features/quota/src/quotad-aggregator.c
+++ b/xlators/features/quota/src/quotad-aggregator.c
@@ -142,7 +142,7 @@ quotad_aggregator_getlimit_cbk(xlator_t *this, call_frame_t *frame,
if (ret < 0)
goto out;
- ret = dict_set_int32n(xdata, "type", SLEN("type"), type);
+ ret = dict_set_int32_sizen(xdata, "type", type);
if (ret < 0)
goto out;
}
@@ -234,26 +234,22 @@ quotad_aggregator_getlimit(rpcsvc_request_t *req)
state = frame->root->state;
state->xdata = dict;
- ret = dict_set_int32n(state->xdata, QUOTA_LIMIT_KEY, SLEN(QUOTA_LIMIT_KEY),
- 42);
+ ret = dict_set_int32_sizen(state->xdata, QUOTA_LIMIT_KEY, 42);
if (ret)
goto err;
- ret = dict_set_int32n(state->xdata, QUOTA_LIMIT_OBJECTS_KEY,
- SLEN(QUOTA_LIMIT_OBJECTS_KEY), 42);
+ ret = dict_set_int32_sizen(state->xdata, QUOTA_LIMIT_OBJECTS_KEY, 42);
if (ret) {
gf_msg(this->name, GF_LOG_ERROR, ENOMEM, Q_MSG_ENOMEM,
"Failed to set QUOTA_LIMIT_OBJECTS_KEY");
goto err;
}
- ret = dict_set_int32n(state->xdata, QUOTA_SIZE_KEY, SLEN(QUOTA_SIZE_KEY),
- 42);
+ ret = dict_set_int32_sizen(state->xdata, QUOTA_SIZE_KEY, 42);
if (ret)
goto err;
- ret = dict_set_int32n(state->xdata, GET_ANCESTRY_PATH_KEY,
- SLEN(GET_ANCESTRY_PATH_KEY), 42);
+ ret = dict_set_int32_sizen(state->xdata, GET_ANCESTRY_PATH_KEY, 42);
if (ret)
goto err;