From 7e229cf1d5d4c0600f0763dac3acacb1b950fc3b Mon Sep 17 00:00:00 2001 From: Yaniv Kaul Date: Tue, 21 Aug 2018 18:32:53 +0300 Subject: extras/geo-rep/gsync-sync-gfid.c: move from strlen() to sizeof() For const strings, just do compile-time size calc instead of runtime. Compile-tested only! Change-Id: I89470016389a4ecb3bed35a1c9e684f5fae79997 updates: bz#1193929 Signed-off-by: Yaniv Kaul --- extras/geo-rep/gsync-sync-gfid.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'extras') diff --git a/extras/geo-rep/gsync-sync-gfid.c b/extras/geo-rep/gsync-sync-gfid.c index e9b9e633402..89b3ebc716e 100644 --- a/extras/geo-rep/gsync-sync-gfid.c +++ b/extras/geo-rep/gsync-sync-gfid.c @@ -30,7 +30,7 @@ main (int argc, char *argv[]) char *gfid = NULL; char *bname = NULL; int ret = -1; - int len = 0; + int len = 0; FILE *fp = NULL; char line[GLFS_LINE_MAX] = {0,}; char *path = NULL; @@ -65,9 +65,10 @@ main (int argc, char *argv[]) while(isspace (*path)) path++; - if ((strlen (line) < GLFS_LINE_MAX) && - (line[strlen (line) - 1] == '\n')) - line[strlen (line) - 1] = '\0'; + len = strlen (line); + if ((len < GLFS_LINE_MAX) && + (line[len - 1] == '\n')) + line[len - 1] = '\0'; line[UUID_CANONICAL_FORM_LEN] = '\0'; -- cgit