commit d29628fad35c5c416fdba30864a63931deb204c1
parent c44b9f73d7f8a474f640bb006df9b659554b42f7
Author: Christian Grothoff <christian@grothoff.org>
Date: Sat, 14 Aug 2010 19:58:45 +0000
reduce strlen calls
Diffstat:
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git 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];
}