summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2018-08-21 18:32:53 +0300
committerAmar Tumballi <amarts@redhat.com>2018-08-25 06:23:49 +0000
commit7e229cf1d5d4c0600f0763dac3acacb1b950fc3b (patch)
tree38df50723039c3094bac59bba1e982cf526248a6
parenta2c562eb4046ce88c8c2f2d250b0079942e7f10a (diff)
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 <ykaul@redhat.com>
-rw-r--r--extras/geo-rep/gsync-sync-gfid.c9
1 files changed, 5 insertions, 4 deletions
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';