summaryrefslogtreecommitdiff
path: root/sysdeps/generic/strcasecmp.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-12-06 01:22:25 +0000
committerUlrich Drepper <drepper@redhat.com>2001-12-06 01:22:25 +0000
commit516a9b2a85104665997e0df32527faceca4cc854 (patch)
tree9e78a7b4ccd743429091cc0ea487630e6ebe61e2 /sysdeps/generic/strcasecmp.c
parent71ede9a8f8d6c891d706e52dc8b85c7a1623601a (diff)
(__strcasecmp): Little performance patch.
Diffstat (limited to 'sysdeps/generic/strcasecmp.c')
-rw-r--r--sysdeps/generic/strcasecmp.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/sysdeps/generic/strcasecmp.c b/sysdeps/generic/strcasecmp.c
index a2b7e9ee1c..41766dff65 100644
--- a/sysdeps/generic/strcasecmp.c
+++ b/sysdeps/generic/strcasecmp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991,1992,1995,1996,1997,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -54,21 +54,16 @@ __strcasecmp (s1, s2 LOCALE_PARAM)
{
const unsigned char *p1 = (const unsigned char *) s1;
const unsigned char *p2 = (const unsigned char *) s2;
- unsigned char c1, c2;
+ int result;
if (p1 == p2)
return 0;
- do
- {
- c1 = TOLOWER (*p1++);
- c2 = TOLOWER (*p2++);
- if (c1 == '\0')
- break;
- }
- while (c1 == c2);
+ while ((result = TOLOWER (*p1) - TOLOWER (*p2++)) == 0)
+ if (*p1++ == '\0')
+ break;
- return c1 - c2;
+ return result;
}
#ifndef __strcasecmp
weak_alias (__strcasecmp, strcasecmp)