From d29628fad35c5c416fdba30864a63931deb204c1 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 14 Aug 2010 19:58:45 +0000 Subject: reduce strlen calls --- src/main/extractor.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/extractor.c b/src/main/extractor.c index fe379be..800fb22 100644 --- a/src/main/extractor.c +++ b/src/main/extractor.c @@ -1170,6 +1170,8 @@ process_requests (struct EXTRACTOR_PluginList *plugin, { char hfn[256]; char tfn[256]; + size_t hfn_len; + size_t tfn_len; char *fn; FILE *fin; void *ptr; @@ -1228,17 +1230,19 @@ process_requests (struct EXTRACTOR_PluginList *plugin, } while (NULL != fgets (hfn, sizeof(hfn), fin)) { - if (strlen (hfn) <= 1) + hfn_len = strlen (hfn); + if (hfn_len <= 1) break; ptr = NULL; - hfn[strlen(hfn)-1] = '\0'; /* kill newline */ + hfn[--hfn_len] = '\0'; /* kill newline */ if (NULL == fgets (tfn, sizeof(tfn), fin)) break; if ('!' != tfn[0]) break; - tfn[strlen(tfn)-1] = '\0'; /* kill newline */ + tfn_len = strlen (tfn); + tfn[--tfn_len] = '\0'; /* kill newline */ if ( (want_tail) && - (strlen (tfn) > 1) ) + (tfn_len > 1) ) { fn = &tfn[1]; } -- cgit v1.2.3