[svn] GnuPG - r4482 - in branches/STABLE-BRANCH-1-4: include util
svn author dshaw
cvs at cvs.gnupg.org
Tue Apr 17 00:32:29 CEST 2007
Author: dshaw
Date: 2007-04-17 00:32:28 +0200 (Tue, 17 Apr 2007)
New Revision: 4482
Modified:
branches/STABLE-BRANCH-1-4/include/ChangeLog
branches/STABLE-BRANCH-1-4/include/compat.h
branches/STABLE-BRANCH-1-4/include/util.h
branches/STABLE-BRANCH-1-4/util/ChangeLog
branches/STABLE-BRANCH-1-4/util/compat.c
branches/STABLE-BRANCH-1-4/util/strgutil.c
Log:
Move some ascii_foo functions to libcompat
Modified: branches/STABLE-BRANCH-1-4/include/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/include/ChangeLog 2007-04-16 21:55:53 UTC (rev 4481)
+++ branches/STABLE-BRANCH-1-4/include/ChangeLog 2007-04-16 22:32:28 UTC (rev 4482)
@@ -1,3 +1,8 @@
+2007-04-16 David Shaw <dshaw at jabberwocky.com>
+
+ * util.h (ascii_toupper, ascii_tolower, ascii_strcasecmp,
+ ascii_strncasecmp): Move functions to compat.h.
+
2006-12-11 Werner Koch <wk at g10code.com>
* mpi.h (mpi_is_neg, mpi_get_nlimbs): Replaced macros by function
Modified: branches/STABLE-BRANCH-1-4/include/compat.h
===================================================================
--- branches/STABLE-BRANCH-1-4/include/compat.h 2007-04-16 21:55:53 UTC (rev 4481)
+++ branches/STABLE-BRANCH-1-4/include/compat.h 2007-04-16 22:32:28 UTC (rev 4482)
@@ -6,6 +6,10 @@
#define ascii_isspace(a) ((a)==' ' || (a)=='\n' || (a)=='\r' || (a)=='\t')
int hextobyte( const char *s );
+int ascii_toupper (int c);
+int ascii_tolower (int c);
+int ascii_strcasecmp( const char *a, const char *b );
+int ascii_strncasecmp( const char *a, const char *b, size_t n);
#ifndef HAVE_STRSEP
char *strsep (char **stringp, const char *delim);
Modified: branches/STABLE-BRANCH-1-4/include/util.h
===================================================================
--- branches/STABLE-BRANCH-1-4/include/util.h 2007-04-16 21:55:53 UTC (rev 4481)
+++ branches/STABLE-BRANCH-1-4/include/util.h 2007-04-16 22:32:28 UTC (rev 4482)
@@ -194,10 +194,6 @@
int ascii_isupper (int c);
int ascii_islower (int c);
-int ascii_toupper (int c);
-int ascii_tolower (int c);
-int ascii_strcasecmp( const char *a, const char *b );
-int ascii_strncasecmp( const char *a, const char *b, size_t n);
int ascii_memcasecmp( const char *a, const char *b, size_t n);
#ifndef HAVE_STPCPY
Modified: branches/STABLE-BRANCH-1-4/util/ChangeLog
===================================================================
--- branches/STABLE-BRANCH-1-4/util/ChangeLog 2007-04-16 21:55:53 UTC (rev 4481)
+++ branches/STABLE-BRANCH-1-4/util/ChangeLog 2007-04-16 22:32:28 UTC (rev 4482)
@@ -1,3 +1,8 @@
+2007-04-16 David Shaw <dshaw at jabberwocky.com>
+
+ * strgutil.c (ascii_toupper, ascii_tolower, ascii_strcasecmp,
+ ascii_strncasecmp): Move functions to compat.c.
+
2007-04-16 Werner Koch <wk at g10code.com>
* secmem.c (init_pool): Avoid assigning a negative value to a
Modified: branches/STABLE-BRANCH-1-4/util/compat.c
===================================================================
--- branches/STABLE-BRANCH-1-4/util/compat.c 2007-04-16 21:55:53 UTC (rev 4481)
+++ branches/STABLE-BRANCH-1-4/util/compat.c 2007-04-16 22:32:28 UTC (rev 4482)
@@ -1,3 +1,5 @@
+#include <sys/types.h>
+
int
hextobyte (const char *s)
{
@@ -22,3 +24,71 @@
return -1;
return c;
}
+
+int
+ascii_toupper (int c)
+{
+ if (c >= 'a' && c <= 'z')
+ c &= ~0x20;
+ return c;
+}
+
+int
+ascii_tolower (int c)
+{
+ if (c >= 'A' && c <= 'Z')
+ c |= 0x20;
+ return c;
+}
+
+int
+ascii_strcasecmp (const char *a, const char *b)
+{
+ const unsigned char *p1 = (const unsigned char *)a;
+ const unsigned char *p2 = (const unsigned char *)b;
+ unsigned char c1, c2;
+
+ if (p1 == p2)
+ return 0;
+
+ do
+ {
+ c1 = ascii_tolower (*p1);
+ c2 = ascii_tolower (*p2);
+
+ if (c1 == '\0')
+ break;
+
+ ++p1;
+ ++p2;
+ }
+ while (c1 == c2);
+
+ return c1 - c2;
+}
+
+int
+ascii_strncasecmp (const char *a, const char *b, size_t n)
+{
+ const unsigned char *p1 = (const unsigned char *)a;
+ const unsigned char *p2 = (const unsigned char *)b;
+ unsigned char c1, c2;
+
+ if (p1 == p2 || !n )
+ return 0;
+
+ do
+ {
+ c1 = ascii_tolower (*p1);
+ c2 = ascii_tolower (*p2);
+
+ if ( !--n || c1 == '\0')
+ break;
+
+ ++p1;
+ ++p2;
+ }
+ while (c1 == c2);
+
+ return c1 - c2;
+}
Modified: branches/STABLE-BRANCH-1-4/util/strgutil.c
===================================================================
--- branches/STABLE-BRANCH-1-4/util/strgutil.c 2007-04-16 21:55:53 UTC (rev 4481)
+++ branches/STABLE-BRANCH-1-4/util/strgutil.c 2007-04-16 22:32:28 UTC (rev 4482)
@@ -1058,77 +1058,7 @@
return c >= 'a' && c <= 'z';
}
-int
-ascii_toupper (int c)
-{
- if (c >= 'a' && c <= 'z')
- c &= ~0x20;
- return c;
-}
-
-int
-ascii_tolower (int c)
-{
- if (c >= 'A' && c <= 'Z')
- c |= 0x20;
- return c;
-}
-
-
int
-ascii_strcasecmp (const char *a, const char *b)
-{
- const unsigned char *p1 = (const unsigned char *)a;
- const unsigned char *p2 = (const unsigned char *)b;
- unsigned char c1, c2;
-
- if (p1 == p2)
- return 0;
-
- do
- {
- c1 = ascii_tolower (*p1);
- c2 = ascii_tolower (*p2);
-
- if (c1 == '\0')
- break;
-
- ++p1;
- ++p2;
- }
- while (c1 == c2);
-
- return c1 - c2;
-}
-
-int
-ascii_strncasecmp (const char *a, const char *b, size_t n)
-{
- const unsigned char *p1 = (const unsigned char *)a;
- const unsigned char *p2 = (const unsigned char *)b;
- unsigned char c1, c2;
-
- if (p1 == p2 || !n )
- return 0;
-
- do
- {
- c1 = ascii_tolower (*p1);
- c2 = ascii_tolower (*p2);
-
- if ( !--n || c1 == '\0')
- break;
-
- ++p1;
- ++p2;
- }
- while (c1 == c2);
-
- return c1 - c2;
-}
-
-
-int
ascii_memcasecmp( const char *a, const char *b, size_t n )
{
if (a == b)
More information about the Gnupg-commits
mailing list