rpmio/strcasecmp.c

Go to the documentation of this file.
00001 
00005 #include "system.h"
00006 #include "rpmio.h"
00007 #include "debug.h"
00008 
00009 int xstrcasecmp(const char * s1, const char * s2)
00010 {
00011   const char * p1 = s1;
00012   const char * p2 = s2;
00013   char c1, c2;
00014 
00015   if (p1 == p2)
00016     return 0;
00017 
00018   do
00019     {
00020 /*@-boundsread@*/
00021       c1 = xtolower (*p1++);
00022       c2 = xtolower (*p2++);
00023 /*@=boundsread@*/
00024       if (c1 == '\0')
00025         break;
00026     }
00027   while (c1 == c2);
00028 
00029   return (int)(c1 - c2);
00030 }
00031 
00032 int xstrncasecmp(const char *s1, const char *s2, size_t n)
00033 {
00034   const char * p1 = s1;
00035   const char * p2 = s2;
00036   char c1, c2;
00037 
00038   if (p1 == p2 || n == 0)
00039     return 0;
00040 
00041   do
00042     {
00043 /*@-boundsread@*/
00044       c1 = xtolower (*p1++);
00045       c2 = xtolower (*p2++);
00046 /*@=boundsread@*/
00047       if (c1 == '\0' || c1 != c2)
00048         break;
00049     } while (--n > 0);
00050 
00051   return (int)(c1 - c2);
00052 }

Generated on Fri Oct 12 08:44:55 2007 for rpm by  doxygen 1.5.2