diff options
author | Yaniv Kaul <ykaul@redhat.com> | 2018-08-21 19:33:16 +0300 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-08-31 02:14:06 +0000 |
commit | d6d729b0609957c0382749c30da507dda77561b7 (patch) | |
tree | f267deebe2735e1aed4890b31f2e894a04221b58 /xlators/mgmt/glusterd/src/glusterd-op-sm.c | |
parent | 437455c1608a0c644d14798551c77e9513ba9901 (diff) |
xlators: move from strlen() to sizeof()
xlators/features/index/src/index.c
xlators/features/shard/src/shard.c
xlators/features/upcall/src/upcall-internal.c
xlators/mgmt/glusterd/src/glusterd-bitrot.c
xlators/mgmt/glusterd/src/glusterd-locks.c
xlators/mgmt/glusterd/src/glusterd-mountbroker.c
xlators/mgmt/glusterd/src/glusterd-op-sm.c
For const strings, just do compile time size calc instead of runtime.
Compile-tested only!
Change-Id: I995b2b89f14454b3855a4cd0ca90b3f01d5e080f
updates: bz#1193929
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-op-sm.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-op-sm.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c index c013f64c2fe..cd2c364464d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c +++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c @@ -446,16 +446,16 @@ glusterd_check_bitrot_cmd (char *key, char *value, char *errstr, size_t size) { int ret = -1; - if ((!strncmp (key, "bitrot", strlen ("bitrot"))) || - (!strncmp (key, "features.bitrot", strlen ("features.bitrot")))) { + if ((!strncmp (key, "bitrot", SLEN ("bitrot"))) || + (!strncmp (key, "features.bitrot", SLEN ("features.bitrot")))) { snprintf (errstr, size, " 'gluster volume set <VOLNAME> %s' " "is invalid command. Use 'gluster volume bitrot " "<VOLNAME> {enable|disable}' instead.", key); ret = -1; goto out; - } else if ((!strncmp (key, "scrub-freq", strlen ("scrub-freq"))) || + } else if ((!strncmp (key, "scrub-freq", SLEN ("scrub-freq"))) || (!strncmp (key, "features.scrub-freq", - strlen ("features.scrub-freq")))) { + SLEN ("features.scrub-freq")))) { snprintf (errstr, size, " 'gluster volume " "set <VOLNAME> %s' is invalid command. Use 'gluster " "volume bitrot <VOLNAME> scrub-frequency" @@ -463,18 +463,18 @@ glusterd_check_bitrot_cmd (char *key, char *value, char *errstr, size_t size) key); ret = -1; goto out; - } else if ((!strncmp (key, "scrub", strlen ("scrub"))) || + } else if ((!strncmp (key, "scrub", SLEN ("scrub"))) || (!strncmp (key, "features.scrub", - strlen ("features.scrub")))) { + SLEN ("features.scrub")))) { snprintf (errstr, size, " 'gluster volume set <VOLNAME> %s' is " "invalid command. Use 'gluster volume bitrot " "<VOLNAME> scrub {pause|resume}' instead.", key); ret = -1; goto out; } else if ((!strncmp (key, "scrub-throttle", - strlen ("scrub-throttle"))) || + SLEN ("scrub-throttle"))) || (!strncmp (key, "features.scrub-throttle", - strlen ("features.scrub-throttle")))) { + SLEN ("features.scrub-throttle")))) { snprintf (errstr, size, " 'gluster volume set <VOLNAME> %s' is " "invalid command. Use 'gluster volume bitrot " "<VOLNAME> scrub-throttle {lazy|normal|aggressive}' " @@ -841,10 +841,10 @@ glusterd_validate_shared_storage (char *key, char *value, char *errstr) goto out; } - if (!strncmp (value, "disable", strlen ("disable"))) { + if (!strncmp (value, "disable", SLEN ("disable"))) { ret = dict_get_str (conf->opts, GLUSTERD_SHARED_STORAGE_KEY, &op); - if (ret || !strncmp (op, "disable", strlen ("disable"))) { + if (ret || !strncmp (op, "disable", SLEN ("disable"))) { snprintf (errstr, PATH_MAX, "Shared storage volume " "does not exist. Please enable shared storage" " for creating shared storage volume."); |