summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2019-12-09 21:28:00 +0200
committerAmar Tumballi <amarts@gmail.com>2020-01-14 17:11:22 +0000
commit9969d1dc2a3e815b161ce8a3dc5d08f84cfe011f (patch)
tree4ee28dd04d0a16d6057a7913455d9b3e0df5b61d /xlators/mgmt/glusterd/src/glusterd-peer-utils.c
parentdc5b2d3c181020da1644106e5b17f77a4f3e53df (diff)
multiple xlators: reduce key length
In many cases, we were freely allocating long keys with no need. Smaller char arrays are just fine almost anywhere, so just went ahead and looked where they we can use smaller ones. In some cases, annotated the functions as static and the prefixes passed as const as it was easier to read and understand. Where relevant, converted the dict functions to use known key length. Change-Id: I882ab33ea20d90b63278336cd1370c09ffdab7f2 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-peer-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-peer-utils.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
index 1a55a5a5375..82acf5bf03c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
@@ -823,7 +823,7 @@ gd_peerinfo_from_dict(dict_t *dict, const char *prefix)
xlator_t *this = NULL;
glusterd_conf_t *conf = NULL;
glusterd_peerinfo_t *new_peer = NULL;
- char key[100] = {
+ char key[64] = {
0,
};
char *uuid_str = NULL;
@@ -868,14 +868,14 @@ out:
return new_peer;
}
-int
+static int
gd_add_peer_hostnames_to_dict(glusterd_peerinfo_t *peerinfo, dict_t *dict,
const char *prefix)
{
int ret = -1;
xlator_t *this = NULL;
glusterd_conf_t *conf = NULL;
- char key[256] = {
+ char key[64] = {
0,
};
glusterd_peer_hostname_t *addr = NULL;
@@ -917,7 +917,7 @@ gd_add_peer_detail_to_dict(glusterd_peerinfo_t *peerinfo, dict_t *friends,
int count)
{
int ret = -1;
- char key[64] = {
+ char key[32] = {
0,
};
int keylen;