summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2018-08-02 16:02:33 +0300
committerAmar Tumballi <amarts@redhat.com>2018-08-14 05:15:04 +0000
commitb2b6ab8eff317f6a507ab23897ea6cd5c718d99a (patch)
tree45fb1392f535f0236f057d9d9c932feda4f9ab40 /xlators/mgmt/glusterd/src/glusterd-peer-utils.c
parent32c8f70f49c0e287c53998e37867f00fa775377b (diff)
All: remove memset() before sprintf()
It's not needed. There's a good chance the compiler is smart enough to remove it anyway, but it can't hurt - I hope. Compile-tested only! Change-Id: Id7c054e146ba630227affa591007803f3046416b 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.c14
1 files changed, 0 insertions, 14 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
index 6652049a27e..6d0cb2131d6 100644
--- a/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-peer-utils.c
@@ -590,7 +590,6 @@ gd_add_friend_to_dict (glusterd_peerinfo_t *friend, dict_t *dict,
/* Setting the first hostname from the list with this key for backward
* compatibility
*/
- memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s.hostname", prefix);
address = cds_list_entry (&friend->hostnames, glusterd_peer_hostname_t,
hostname_list);
@@ -612,7 +611,6 @@ gd_add_friend_to_dict (glusterd_peerinfo_t *friend, dict_t *dict,
cds_list_for_each_entry (address, &friend->hostnames, hostname_list) {
GF_VALIDATE_OR_GOTO (this->name, (address != NULL), out);
- memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s.hostname%d", prefix, count);
ret = dict_set_dynstr_with_alloc (dict, key, address->hostname);
if (ret) {
@@ -623,7 +621,6 @@ gd_add_friend_to_dict (glusterd_peerinfo_t *friend, dict_t *dict,
}
count++;
}
- memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s.address-count", prefix);
ret = dict_set_int32 (dict, key, count);
if (ret)
@@ -771,7 +768,6 @@ gd_update_peerinfo_from_dict (glusterd_peerinfo_t *peerinfo, dict_t *dict,
GF_VALIDATE_OR_GOTO (this->name, (dict != NULL), out);
GF_VALIDATE_OR_GOTO (this->name, (prefix != NULL), out);
- memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s.hostname", prefix);
ret = dict_get_str (dict, key, &hostname);
if (ret) {
@@ -797,7 +793,6 @@ gd_update_peerinfo_from_dict (glusterd_peerinfo_t *peerinfo, dict_t *dict,
goto out;
}
- memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s.address-count", prefix);
ret = dict_get_int32 (dict, key, &count);
if (ret) {
@@ -808,7 +803,6 @@ gd_update_peerinfo_from_dict (glusterd_peerinfo_t *peerinfo, dict_t *dict,
}
hostname = NULL;
for (i = 0; i < count; i++) {
- memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s.hostname%d",prefix, i);
ret = dict_get_str (dict, key, &hostname);
if (ret) {
@@ -916,7 +910,6 @@ gd_add_peer_hostnames_to_dict (glusterd_peerinfo_t *peerinfo, dict_t *dict,
GF_VALIDATE_OR_GOTO (this->name, (prefix != NULL), out);
cds_list_for_each_entry (addr, &peerinfo->hostnames, hostname_list) {
- memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s.hostname%d", prefix, count);
ret = dict_set_dynstr_with_alloc (dict, key, addr->hostname);
if (ret)
@@ -924,7 +917,6 @@ gd_add_peer_hostnames_to_dict (glusterd_peerinfo_t *peerinfo, dict_t *dict,
count++;
}
- memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "%s.hostname_count", prefix);
ret = dict_set_int32 (dict, key, count);
@@ -950,38 +942,32 @@ gd_add_peer_detail_to_dict (glusterd_peerinfo_t *peerinfo, dict_t *friends,
if (ret)
goto out;
- memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "friend%d.hostname", count);
ret = dict_set_str (friends, key, peerinfo->hostname);
if (ret)
goto out;
- memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "friend%d.port", count);
ret = dict_set_int32 (friends, key, peerinfo->port);
if (ret)
goto out;
- memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "friend%d.stateId", count);
ret = dict_set_int32 (friends, key, peerinfo->state.state);
if (ret)
goto out;
- memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "friend%d.state", count);
ret = dict_set_str (friends, key,
glusterd_friend_sm_state_name_get(peerinfo->state.state));
if (ret)
goto out;
- memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "friend%d.connected", count);
ret = dict_set_int32 (friends, key, (int32_t)peerinfo->connected);
if (ret)
goto out;
- memset (key, 0, sizeof (key));
snprintf (key, sizeof (key), "friend%d", count);
ret = gd_add_peer_hostnames_to_dict (peerinfo, friends, key);