-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I have added strcasecmp and strncasecmp equivalant functions to the
axis2_string.
Please patch files and commit the code.

- - Sahan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iQEVAwUBQ542sqnIlEsDdb85AQLXvwf7BS7SimlBAscy0dbAC+vkyhDcwDrPkkh0
es6jxrMQoBnmHOzniD1MuKx3O0yolWPRGlPc9bDNpSr5CNBmtH6QZv8AYO8FC1Mu
e7vBjn9WDxyo2jSvZfuD4TZIcrgG4u9qD5bmARwTXW/iS69IkhGAa+K8IgZSOK7X
XSI7VX/FUT6nbAFDIqxV1RPn2PV7mxb1Mtonb36F8IKjPCgrSvT0XahoSzwtrolw
GYLvHKruUp+wBGHn39wiVpsT5OzxSDiEZ66m21FgPtbzoz7UnumYjOmAAWPsIHz0
doxVIK4SeZ5bSK2UGRAMU2G3SD9BxXg2Ns/TAynlpXjUx5BLNgcfFg==
=xCD3
-----END PGP SIGNATURE-----

Index: string.c
===================================================================
--- string.c    (revision 356452)
+++ string.c    (working copy)
@@ -19,6 +19,7 @@
 #include <string.h>
 #include <axis2.h>
 #include <axis2_defines.h>
+#include <ctype.h>
 
 AXIS2_DECLARE(void*)
 axis2_strdup (const void *ptr, axis2_env_t **env)
@@ -51,3 +52,29 @@
         return -1;
 }
 
+
+AXIS2_DECLARE(axis2_ssize_t)
+axis2_strlen (const axis2_char_t * s)
+{
+       return strlen(s);
+}
+
+
+AXIS2_DECLARE(int)
+axis2_strcasecmp(const axis2_char_t *s1, axis2_char_t *s2)
+{
+    while (toupper(*s1) == toupper(*s2++))
+       if (*s1++ == '\0')
+           return(0);
+    return(toupper(*s1) - toupper(*--s2));
+}
+
+
+AXIS2_DECLARE(int)
+axis2_strncasecmp(const axis2_char_t *s1, axis2_char_t *s2, int n)
+{
+    while (--n >= 0 && toupper(*s1) == toupper(*s2++))
+       if (toupper(*s1++) == '\0')
+           return(0);
+    return(n < 0 ? 0 : toupper(*s1) - toupper(*--s2));
+}
Index: axis2_string.h
===================================================================
--- axis2_string.h      (revision 356452)
+++ axis2_string.h      (working copy)
@@ -38,9 +38,20 @@
     AXIS2_DECLARE(int)
     axis2_strcmp (const axis2_char_t * s1, const axis2_char_t * s2);
 
+    AXIS2_DECLARE(axis2_ssize_t)
+    axis2_strlen(const axis2_char_t * s);
+
+    AXIS2_DECLARE(int)
+    axis2_strcasecmp(const axis2_char_t *s1, axis2_char_t *s2);
+
+    AXIS2_DECLARE(int)
+    axis2_strncasecmp(const axis2_char_t *s1, axis2_char_t *s2, int n);
+
 #define AXIS2_STRDUP(pts, env) axis2_strdup(pts, env)
 #define AXIS2_STRCMP(s1, s2) axis2_strcmp(s1, s2)
-
+#define AXIS2_STRLEN(s) axis2_strlen(s)
+#define AXIS2_STRCASECMP(s1,s2) axis2_strcasecmp(s1,s2)
+#define AXIS2_STRNCASECMP(s1,s2,n) axis2_strncasecmp(s1,s2,n)
 /** @} */
     
 #ifdef __cplusplus

Reply via email to