From 537fad7df40d043162d3d89ba00bf636ef492700 Mon Sep 17 00:00:00 2001 From: Douglas Clowes Date: Mon, 5 Aug 2013 09:45:29 +1000 Subject: [PATCH] Move constant strlen call outside of loop code --- exebuf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/exebuf.c b/exebuf.c index f4d0772b..331f3095 100644 --- a/exebuf.c +++ b/exebuf.c @@ -151,7 +151,7 @@ static pDynString findBlockEnd(pExeBuf self) { pDynString command = NULL; char *buffer = NULL; - int i; + int i, j; assert(self); @@ -163,7 +163,8 @@ static pDynString findBlockEnd(pExeBuf self) if (self->end != -1) { self->start = self->end + 1; } - for (i = self->start; i < strlen(buffer); i++) { + j = strlen(buffer); + for (i = self->start; i < j; i++) { DynStringConcatChar(command, buffer[i]); if (buffer[i] == '\n') { self->lineno++;