LIBGCRYPT-1-2-BRANCH libgcrypt/src (ChangeLog gcrypt.h sexp.c)

cvs user wk cvs at cvs.gnupg.org
Thu Apr 14 19:25:48 CEST 2005


    Date: Thursday, April 14, 2005 @ 19:42:07
  Author: wk
    Path: /cvs/libgcrypt/libgcrypt/src
     Tag: LIBGCRYPT-1-2-BRANCH

Modified: ChangeLog gcrypt.h sexp.c

(whitespacep): New.
(sexp_sscan): Replace isdigit and isspace by whitespacep and
digitp.


-----------+
 ChangeLog |    6 ++++++
 gcrypt.h  |    2 +-
 sexp.c    |   45 +++++++++++++++++++++++++++++++--------------
 3 files changed, 38 insertions(+), 15 deletions(-)


Index: libgcrypt/src/ChangeLog
diff -u libgcrypt/src/ChangeLog:1.151.2.12 libgcrypt/src/ChangeLog:1.151.2.13
--- libgcrypt/src/ChangeLog:1.151.2.12	Tue Feb 22 18:59:21 2005
+++ libgcrypt/src/ChangeLog	Thu Apr 14 19:42:07 2005
@@ -1,3 +1,9 @@
+2005-04-14  Werner Koch  <wk at g10code.com>
+
+	* sexp.c (whitespacep): New.
+	(sexp_sscan): Replace isdigit and isspace by whitespacep and
+	digitp.
+
 2005-02-22  Werner Koch  <wk at g10code.com>
 
 	* global.c (_gcry_malloc): Make sure ERRNO is set if we return
Index: libgcrypt/src/gcrypt.h
diff -u libgcrypt/src/gcrypt.h:1.125.2.6 libgcrypt/src/gcrypt.h:1.125.2.7
--- libgcrypt/src/gcrypt.h:1.125.2.6	Wed Jan  5 17:07:31 2005
+++ libgcrypt/src/gcrypt.h	Thu Apr 14 19:42:07 2005
@@ -49,7 +49,7 @@
    autoconf (using the AM_PATH_GCRYPT macro) check that this header
    matches the installed library.  Note: Do not edit the next line as
    configure may fix the string here.  */
-#define GCRYPT_VERSION "1.2.1"
+#define GCRYPT_VERSION "1.2.2-cvs"
 
 /* Internal: We can't use the convenience macros for the multi
    precision integer functions when building this library. */
Index: libgcrypt/src/sexp.c
diff -u libgcrypt/src/sexp.c:1.40.2.1 libgcrypt/src/sexp.c:1.40.2.2
--- libgcrypt/src/sexp.c:1.40.2.1	Tue Sep 21 12:19:11 2004
+++ libgcrypt/src/sexp.c	Thu Apr 14 19:42:07 2005
@@ -54,11 +54,28 @@
 
 #define TOKEN_SPECIALS  "-./_:*+="
 
+
+
 static gcry_error_t
 sexp_sscan (gcry_sexp_t *retsexp, size_t *erroff,
 	    const char *buffer, size_t length, int argflag,
 	    va_list arg_ptr, void **arg_list);
 
+
+/* Return true if P points to a byte containing a whitespace according
+   to the S-expressions definition. */
+#undef whitespacep
+static GPG_ERR_INLINE int
+whitespacep (const unsigned char *p)
+{ 
+  switch (*p)
+    {
+    case ' ': case '\t': case '\v': case '\f': case '\r': case '\n': return 1;
+    default: return 0;
+    }
+}
+
+
 #if 0
 static void
 dump_mpi( gcry_mpi_t a )
@@ -902,7 +919,7 @@
 
   /* FIXME: invent better error codes (?).  */
 
-  if (! erroff)
+  if (!erroff)
     erroff = &dummy_erroff;
 
   /* Depending on wether ARG_LIST is non-zero or not, this macro gives
@@ -911,7 +928,7 @@
 #define ARG_NEXT(storage, type)                          \
   do                                                     \
     {                                                    \
-      if (! arg_list)                                    \
+      if (!arg_list)                                    \
 	storage = va_arg (arg_ptr, type);                \
       else                                               \
 	storage = *((type *) (arg_list[arg_counter++])); \
@@ -937,7 +954,7 @@
 
   for (p = buffer, n = length; n; p++, n--)
     {
-      if (tokenp && (! hexfmt))
+      if (tokenp && !hexfmt)
 	{
 	  if (strchr (tokenchars, *p))
 	    continue;
@@ -966,9 +983,9 @@
 
 		case '0': case '1': case '2': case '3': case '4':
 		case '5': case '6': case '7':
-		  if (! ((n > 2)
-			 && (p[1] >= '0') && (p[1] <= '7')
-			 && (p[2] >= '0') && (p[2] <= '7')))
+		  if (!((n > 2)
+                        && (p[1] >= '0') && (p[1] <= '7')
+                        && (p[2] >= '0') && (p[2] <= '7')))
 		    {
 		      *erroff = p - buffer;
 		      /* Invalid octal value.  */
@@ -980,7 +997,7 @@
 		  break;
 		  
 		case 'x':
-		  if (! ((n > 2) && isxdigit(p[1]) && isxdigit(p[2])))
+		  if (!((n > 2) && isxdigit(p[1]) && isxdigit(p[2])))
 		    {
 		      *erroff = p - buffer;
 		      /* Invalid hex value.  */
@@ -1055,14 +1072,14 @@
 	      STORE_LEN (c.pos, datalen);
 	      for (hexfmt++; hexfmt < p; hexfmt++)
 		{
-		  if (isspace (*hexfmt))
+		  if (whitespacep (hexfmt))
 		    continue;
 		  *c.pos++ = hextobyte (hexfmt);
 		  hexfmt++;
 		}
 	      hexfmt = NULL;
 	    }
-	  else if (! isspace (*p))
+	  else if (!whitespacep (p))
 	    {
 	      *erroff = p - buffer;
 	      err = GPG_ERR_SEXP_BAD_HEX_CHAR;
@@ -1075,7 +1092,7 @@
 	}
       else if (digptr)
 	{
-	  if (isdigit (*p))
+	  if (digitp (p))
 	    ;
 	  else if (*p == ':')
 	    {
@@ -1133,7 +1150,7 @@
 		BUG ();
 
 	      MAKE_SPACE (nm);
-	      if ((! gcry_is_secure (c.sexp->d))
+	      if ((!gcry_is_secure (c.sexp->d))
 		  &&  gcry_mpi_get_flag ( m, GCRYMPI_FLAG_SECURE))
 		{
 		  /* We have to switch to secure allocation.  */
@@ -1275,7 +1292,7 @@
 	}
       else if (*p == ']')
 	{
-	  if (! disphint)
+	  if (!disphint)
 	    {
 	      *erroff = p - buffer;
 	      /* Open display hint.  */
@@ -1283,7 +1300,7 @@
 	    }
 	  disphint = NULL;
 	}
-      else if (isdigit (*p))
+      else if (digitp (p))
 	{
 	  if (*p == '0')
 	    {
@@ -1295,7 +1312,7 @@
 	}
       else if (strchr (tokenchars, *p))
 	tokenp = p;
-      else if (isspace (*p))
+      else if (whitespacep (p))
 	;
       else if (*p == '{')
 	{




More information about the Gnupg-commits mailing list