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/features | |
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/features')
-rw-r--r-- | xlators/features/index/src/index.c | 2 | ||||
-rw-r--r-- | xlators/features/shard/src/shard.c | 4 | ||||
-rw-r--r-- | xlators/features/upcall/src/upcall-internal.c | 4 |
3 files changed, 5 insertions, 5 deletions
diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c index 86c21e9aa83..3a518248c13 100644 --- a/xlators/features/index/src/index.c +++ b/xlators/features/index/src/index.c @@ -1081,7 +1081,7 @@ index_inode_path (xlator_t *this, inode_t *inode, char *dirpath, size_t len) } make_index_dir_path (priv->index_basepath, ENTRY_CHANGES_SUBDIR, dirpath, len); - if (len <= strlen (dirpath) + 1 /*'/'*/ + strlen (UUID0_STR)) { + if (len <= strlen (dirpath) + 1 /*'/'*/ + SLEN (UUID0_STR)) { ret = -EINVAL; goto out; } diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c index 39f144e9668..6c075ac5bf7 100644 --- a/xlators/features/shard/src/shard.c +++ b/xlators/features/shard/src/shard.c @@ -6209,7 +6209,7 @@ shard_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, if ((frame->root->pid != GF_CLIENT_PID_GSYNCD) && (name) && (!strncmp (name, SHARD_XATTR_PREFIX, - strlen (SHARD_XATTR_PREFIX)))) { + SLEN (SHARD_XATTR_PREFIX)))) { op_errno = ENODATA; goto out; } @@ -6249,7 +6249,7 @@ shard_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, if ((frame->root->pid != GF_CLIENT_PID_GSYNCD) && (name) && (!strncmp (name, SHARD_XATTR_PREFIX, - strlen (SHARD_XATTR_PREFIX)))) { + sizeof (SHARD_XATTR_PREFIX) - 1))) { op_errno = ENODATA; goto out; } diff --git a/xlators/features/upcall/src/upcall-internal.c b/xlators/features/upcall/src/upcall-internal.c index 73ade8324b7..7635063c14e 100644 --- a/xlators/features/upcall/src/upcall-internal.c +++ b/xlators/features/upcall/src/upcall-internal.c @@ -442,7 +442,7 @@ up_compare_afr_xattr (dict_t *d, char *k, data_t *v, void *tmp) { dict_t *dict = tmp; - if (!strncmp (k, AFR_XATTR_PREFIX, strlen (AFR_XATTR_PREFIX)) + if (!strncmp (k, AFR_XATTR_PREFIX, SLEN (AFR_XATTR_PREFIX)) && (!is_data_equal (v, dict_get (dict, k)))) return -1; @@ -457,7 +457,7 @@ up_filter_afr_xattr (dict_t *xattrs, char *xattr, data_t *v) * be executed only in case of xattrop and not in set and removexattr, * butset and remove xattr fops do not come with keys AFR_XATTR_PREFIX */ - if (!strncmp (xattr, AFR_XATTR_PREFIX, strlen (AFR_XATTR_PREFIX)) + if (!strncmp (xattr, AFR_XATTR_PREFIX, SLEN (AFR_XATTR_PREFIX)) && (mem_0filled (v->data, v->len) == 0)) { dict_del (xattrs, xattr); } |