diff options
author | Yaniv Kaul <ykaul@redhat.com> | 2018-08-21 20:32:01 +0300 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-08-31 06:13:54 +0000 |
commit | 058d215174b93b3aa14be99073979f45642e519e (patch) | |
tree | c0e1d2a040d549058eee88c09737f178e1fd893d | |
parent | d6d729b0609957c0382749c30da507dda77561b7 (diff) |
multiple xlators: move from strlen() to sizeof()
xlators/performance/nl-cache/src/nl-cache.c
xlators/performance/md-cache/src/md-cache.c
xlators/protocol/server/src/authenticate.c
xlators/storage/bd/src/bd-helper.c
For const strings, just do compile time size calc instead of runtime.
Compile-tested only!
Change-Id: I9b98940a38d85321a69436a1871930da367b918a
updates: bz#1193929
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
-rw-r--r-- | xlators/performance/md-cache/src/md-cache.c | 2 | ||||
-rw-r--r-- | xlators/performance/nl-cache/src/nl-cache.c | 4 | ||||
-rw-r--r-- | xlators/protocol/server/src/authenticate.c | 2 | ||||
-rw-r--r-- | xlators/storage/bd/src/bd-helper.c | 4 |
4 files changed, 6 insertions, 6 deletions
diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c index a1280d6a2cc..7da877f87e2 100644 --- a/xlators/performance/md-cache/src/md-cache.c +++ b/xlators/performance/md-cache/src/md-cache.c @@ -3236,7 +3236,7 @@ mdc_xattr_list_populate (struct mdc_conf *conf, char *tmp_str) size_t max_size = 0; int ret = 0; - max_size = strlen ("security.capability,security.selinux,security.ima," + max_size = SLEN ("security.capability,security.selinux,security.ima," POSIX_ACL_ACCESS_XATTR","POSIX_ACL_DEFAULT_XATTR"," GF_POSIX_ACL_ACCESS","GF_POSIX_ACL_DEFAULT"," "user.swift.metadata,user.DOSATTRIB,user.DosStream.*" diff --git a/xlators/performance/nl-cache/src/nl-cache.c b/xlators/performance/nl-cache/src/nl-cache.c index 0f0e53bac2b..effe91e9798 100644 --- a/xlators/performance/nl-cache/src/nl-cache.c +++ b/xlators/performance/nl-cache/src/nl-cache.c @@ -319,7 +319,7 @@ nlc_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, const char *key, goto wind; if (!key || (strncmp (key, GF_XATTR_GET_REAL_FILENAME_KEY, - strlen (GF_XATTR_GET_REAL_FILENAME_KEY)) != 0)) + SLEN (GF_XATTR_GET_REAL_FILENAME_KEY)) != 0)) goto wind; local = nlc_local_init (frame, this, GF_FOP_GETXATTR, loc, NULL); @@ -331,7 +331,7 @@ nlc_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, const char *key, if (!dict) goto err; - fname = key + strlen (GF_XATTR_GET_REAL_FILENAME_KEY); + fname = key + SLEN (GF_XATTR_GET_REAL_FILENAME_KEY); hit = nlc_get_real_file_name (this, loc, fname, &op_ret, &op_errno, dict); if (hit) diff --git a/xlators/protocol/server/src/authenticate.c b/xlators/protocol/server/src/authenticate.c index 5163d465261..0d95b9a7ac9 100644 --- a/xlators/protocol/server/src/authenticate.c +++ b/xlators/protocol/server/src/authenticate.c @@ -33,7 +33,7 @@ init (dict_t *this, char *key, data_t *value, void *data) /* It gets over written */ error = data; - if (!strncasecmp (key, "ip", strlen ("ip"))) { + if (!strncasecmp (key, "ip", SLEN ("ip"))) { gf_msg ("authenticate", GF_LOG_ERROR, 0, PS_MSG_AUTHENTICATE_ERROR, "AUTHENTICATION MODULE " "\"IP\" HAS BEEN REPLACED BY \"ADDR\""); diff --git a/xlators/storage/bd/src/bd-helper.c b/xlators/storage/bd/src/bd-helper.c index ca5a3b741ba..b2bcf0609da 100644 --- a/xlators/storage/bd/src/bd-helper.c +++ b/xlators/storage/bd/src/bd-helper.c @@ -154,7 +154,7 @@ check: } dm_list_iterate_items (strl, tags) { if (!strncmp (strl->str, GF_XATTR_VOL_ID_KEY, - strlen (GF_XATTR_VOL_ID_KEY))) { + SLEN (GF_XATTR_VOL_ID_KEY))) { uuid = _gf_true; break; } @@ -168,7 +168,7 @@ check: goto out; } - op_ret = gf_uuid_parse (strl->str + strlen (GF_XATTR_VOL_ID_KEY) + 1, + op_ret = gf_uuid_parse (strl->str + SLEN (GF_XATTR_VOL_ID_KEY) + 1, vg_uuid); if (op_ret < 0) { gf_log (this->name, GF_LOG_ERROR, |