Move constant strlen call outside of loop code

This commit is contained in:
Douglas Clowes
2013-08-05 09:45:29 +10:00
parent 0ffc87e3d7
commit 537fad7df4

View File

@ -151,7 +151,7 @@ static pDynString findBlockEnd(pExeBuf self)
{ {
pDynString command = NULL; pDynString command = NULL;
char *buffer = NULL; char *buffer = NULL;
int i; int i, j;
assert(self); assert(self);
@ -163,7 +163,8 @@ static pDynString findBlockEnd(pExeBuf self)
if (self->end != -1) { if (self->end != -1) {
self->start = 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]); DynStringConcatChar(command, buffer[i]);
if (buffer[i] == '\n') { if (buffer[i] == '\n') {
self->lineno++; self->lineno++;