summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt
diff options
context:
space:
mode:
authorsrijan-sivakumar <ssivakum@redhat.com>2020-09-26 19:17:41 +0530
committerMOHIT AGRAWAL <moagrawa@redhat.com>2020-09-28 06:09:36 +0000
commit2d2ea54a2cd895aef40e39109ea98c94aa02a473 (patch)
treebf8cee1b7c0605ba86fe7a0498ea7c863bffafc1 /xlators/mgmt
parentd34daa73fe6eacaca3b4b3ed666ed44ef5d727b4 (diff)
glusterd: Replacing str with ptr in strchr to reduce comparison
Issue: On seeing the function glusterd_replace_slash_with_hyphen we see that the strchr inside the while loop takes str as a parameter, that'd mean repeated comparison from index 0 of str even though the characters have already been compared. Why not use ptr instead which points to the latest replacement in the string. Code change: replacing str with ptr inside the strchr function. Fixes: #1516 Change-Id: Id049ec2ad9800a01730f2a0263d9e0528557ae81 Signed-off-by: srijan-sivakumar <ssivakum@redhat.com>
Diffstat (limited to 'xlators/mgmt')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-store.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c
index de93282..d94dceb 100644
--- a/xlators/mgmt/glusterd/src/glusterd-store.c
+++ b/xlators/mgmt/glusterd/src/glusterd-store.c
@@ -74,7 +74,7 @@ glusterd_replace_slash_with_hyphen(char *str)
while (ptr) {
*ptr = '-';
- ptr = strchr(str, '/');
+ ptr = strchr(ptr, '/');
}
}