diff options
author | Yaniv Kaul <ykaul@redhat.com> | 2019-08-28 19:38:01 +0300 |
---|---|---|
committer | Kotresh HR <khiremat@redhat.com> | 2019-09-05 08:57:12 +0000 |
commit | f6d6c0f65f7b512724694b3436358e1113cbfccb (patch) | |
tree | 7b04c3c1391bbbbb6bc87f9d0b94caff430ed089 /xlators/storage/posix/src/posix-inode-fd-ops.c | |
parent | ee24c0438ce40b0c6faf6581fd4eb162767d8a90 (diff) |
posix*.c: remove unneeded strlen() calls
In various places, we can re-use knowledge of string length
or result of snprintf() and such instead of strlen().
Change-Id: I4c9b1decf1169b3f8ac83699a0afbd7c38fad746
updates: bz#1193929
Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'xlators/storage/posix/src/posix-inode-fd-ops.c')
-rw-r--r-- | xlators/storage/posix/src/posix-inode-fd-ops.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c index 6d2b3106a9a..497502e5d42 100644 --- a/xlators/storage/posix/src/posix-inode-fd-ops.c +++ b/xlators/storage/posix/src/posix-inode-fd-ops.c @@ -109,7 +109,7 @@ posix_cs_build_xattr_rsp(xlator_t *this, dict_t **rsp, dict_t *req, int fd, int ret = 0; uuid_t uuid; - if (!(dict_getn(req, GF_CS_OBJECT_STATUS, strlen(GF_CS_OBJECT_STATUS)))) + if (!dict_get_sizen(req, GF_CS_OBJECT_STATUS)) return; if (!(*rsp)) { @@ -120,8 +120,7 @@ posix_cs_build_xattr_rsp(xlator_t *this, dict_t **rsp, dict_t *req, int fd, } if (fd != -1) { - if (dict_getn(req, GF_CS_XATTR_ARCHIVE_UUID, - strlen(GF_CS_XATTR_ARCHIVE_UUID))) { + if (dict_get_sizen(req, GF_CS_XATTR_ARCHIVE_UUID)) { ret = sys_fgetxattr(fd, GF_CS_XATTR_ARCHIVE_UUID, uuid, 16); if (ret > 0) { ret = dict_set_gfuuid(*rsp, GF_CS_XATTR_ARCHIVE_UUID, uuid, @@ -138,8 +137,7 @@ posix_cs_build_xattr_rsp(xlator_t *this, dict_t **rsp, dict_t *req, int fd, } } } else { - if (dict_getn(req, GF_CS_XATTR_ARCHIVE_UUID, - strlen(GF_CS_XATTR_ARCHIVE_UUID))) { + if (dict_get_sizen(req, GF_CS_XATTR_ARCHIVE_UUID)) { ret = sys_lgetxattr(loc, GF_CS_XATTR_ARCHIVE_UUID, uuid, 16); if (ret > 0) { ret = dict_set_gfuuid(*rsp, GF_CS_XATTR_ARCHIVE_UUID, uuid, @@ -3255,7 +3253,7 @@ posix_get_ancestry_non_directory(xlator_t *this, inode_t *leaf_inode, } while (remaining_size > 0) { - snprintf(key, sizeof(key), "%s", list + list_offset); + len = snprintf(key, sizeof(key), "%s", list + list_offset); if (strncmp(key, PGFID_XATTR_KEY_PREFIX, SLEN(PGFID_XATTR_KEY_PREFIX)) != 0) goto next; @@ -3303,7 +3301,6 @@ posix_get_ancestry_non_directory(xlator_t *this, inode_t *leaf_inode, } next: - len = strlen(key); remaining_size -= (len + 1); list_offset += (len + 1); } /* while (remaining_size > 0) */ |