Avoid ctype.h .
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 26 Apr 2011 12:33:23 +0000 (14:33 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 26 Apr 2011 12:36:19 +0000 (14:36 +0200)
The ctype.h-functions depend on the LANG environment which might be set
to something totally different than a server application assumes. We also
do not need anything but ASCII based checks (HTTP protocol for one).
isxxx functions also require an unsigned int and a cast. These casts can
be avoided now.

57 files changed:
client/client.c
client/fhistory.c
include/yaz/yaz-iconv.h
src/advancegreek.c
src/atoin.c
src/ccl_stop_words.c
src/cclptree.c
src/cclstr.c
src/ccltoken.c
src/comstack.c
src/cql.y
src/cqltransform.c
src/grs1disp.c
src/http.c
src/iconv_decode_danmarc.c
src/iconv_decode_iso5426.c
src/iconv_decode_marc8.c
src/iconv_encode_iso_8859_1.c
src/iconv_encode_marc8.c
src/iconv_encode_wchar.c
src/iso5428.c
src/log.c
src/marc_read_iso2709.c
src/marc_read_line.c
src/marc_read_xml.c
src/marcdisp.c
src/match_glob.c
src/matchstr.c
src/mime.c
src/odr_util.c
src/oid_db.c
src/oid_util.c
src/opacdisp.c
src/pquery.c
src/readconf.c
src/seshigh.c
src/siconv.c
src/solrtransform.c
src/statserv.c
src/tokenizer.c
src/tpath.c
src/ucs4.c
src/utf8.c
src/yaz-ccl.c
test/test_file_glob.c
test/test_filepath.c
test/test_iconv.c
test/test_nmem.c
util/yaziconv.c
zoom/zoom-benchmark.c
zoom/zoomsh.c
zoom/zoomtst3.c
ztest/dummy-opac.c
ztest/gfs-example.c
ztest/read-grs.c
ztest/read-marc.c
ztest/ztest.c

index 71432b4..42a56f0 100644 (file)
@@ -13,7 +13,6 @@
 #include <stdlib.h>
 #include <assert.h>
 #include <time.h>
 #include <stdlib.h>
 #include <assert.h>
 #include <time.h>
-#include <ctype.h>
 #ifndef WIN32
 #include <signal.h>
 #endif
 #ifndef WIN32
 #include <signal.h>
 #endif
@@ -3067,7 +3066,7 @@ static int parse_show_args(const char *arg_c, char *setstring,
     *start = start_position;
     if (*end_ptr == '\0')
         return 1;
     *start = start_position;
     if (*end_ptr == '\0')
         return 1;
-    while (isspace(*(unsigned char *)end_ptr))
+    while (yaz_isspace(*end_ptr))
         end_ptr++;
     if (*end_ptr != '+')
     {
         end_ptr++;
     if (*end_ptr != '+')
     {
@@ -3084,7 +3083,7 @@ static int parse_show_args(const char *arg_c, char *setstring,
     }
     if (*end_ptr == '\0')
         return 1;
     }
     if (*end_ptr == '\0')
         return 1;
-    while (isspace(*(unsigned char *)end_ptr))
+    while (yaz_isspace(*end_ptr))
         end_ptr++;
     if (*end_ptr != '+')
     {
         end_ptr++;
     if (*end_ptr != '+')
     {
@@ -5180,7 +5179,7 @@ static void process_cmd_line(char* line)
 
         for (; *p; ++p)
         {
 
         for (; *p; ++p)
         {
-            if (!isspace(*(unsigned char *) p))
+            if (!yaz_isspace(*p))
                 lastnonspace = p;
         }
         if (lastnonspace)
                 lastnonspace = p;
         }
         if (lastnonspace)
index a34490a..cb92730 100644 (file)
@@ -14,7 +14,6 @@
 #include <stdlib.h>
 #include <assert.h>
 #include <time.h>
 #include <stdlib.h>
 #include <assert.h>
 #include <time.h>
-#include <ctype.h>
 #if HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
 #if HAVE_SYS_TYPES_H
 #include <sys/types.h>
 #endif
index c0ebdd7..a1a2dc4 100644 (file)
@@ -82,6 +82,15 @@ YAZ_EXPORT size_t yaz_write_UTF8_char(unsigned long x,
                                       char **outbuf, size_t *outbytesleft,
                                       int *error);
 
                                       char **outbuf, size_t *outbytesleft,
                                       int *error);
 
+/* ctype.h macros ASCII based. That do not depend on LANG, nor require
+   unsigned int as argument */
+#define yaz_isdigit(x) ((x) >= '0' && (x) <= '9')
+#define yaz_isspace(x) strchr(" \f\r\n\t\v", x)
+#define yaz_toupper(x) ((x) + ('A' - 'a'))
+#define yaz_isupper(x) ((x) >= 'A' && (x) <= 'Z')
+#define yaz_tolower(x) ((x) + ('a' - 'A'))
+#define yaz_islower(x) ((x) >= 'a' && (x) <= 'z')
+
 YAZ_END_CDECL
 
 #endif
 YAZ_END_CDECL
 
 #endif
index 463c595..e4fc0e4 100644 (file)
@@ -14,7 +14,6 @@
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
-#include <ctype.h>
 
 #include "iconv-p.h"
 
 
 #include "iconv-p.h"
 
index 50a8381..39af45f 100644 (file)
@@ -13,8 +13,8 @@
 #endif
 
 #include <string.h>
 #endif
 
 #include <string.h>
-#include <ctype.h>
 #include <yaz/marcdisp.h>
 #include <yaz/marcdisp.h>
+#include <yaz/yaz-iconv.h>
 
 int atoi_n(const char *buf, int len)
 {
 
 int atoi_n(const char *buf, int len)
 {
@@ -22,7 +22,7 @@ int atoi_n(const char *buf, int len)
 
     while (--len >= 0)
     {
 
     while (--len >= 0)
     {
-        if (isdigit(*(const unsigned char *) buf))
+        if (yaz_isdigit(*buf))
             val = val*10 + (*buf - '0');
         buf++;
     }
             val = val*10 + (*buf - '0');
         buf++;
     }
@@ -33,7 +33,7 @@ int atoi_n_check(const char *buf, int size, int *val)
 {
     int i;
     for (i = 0; i < size; i++)
 {
     int i;
     for (i = 0; i < size; i++)
-        if (!isdigit(i[(const unsigned char *) buf]))
+        if (!yaz_isdigit(*buf))
             return 0;
     *val = atoi_n(buf, size);
     return 1;
             return 0;
     *val = atoi_n(buf, size);
     return 1;
index db0e16c..bf6a23a 100644 (file)
@@ -12,7 +12,6 @@
 
 #include <stdio.h>
 #include <string.h>
 
 #include <stdio.h>
 #include <string.h>
-#include <ctype.h>
 #include <yaz/ccl.h>
 #include <yaz/nmem.h>
 
 #include <yaz/ccl.h>
 #include <yaz/nmem.h>
 
index 1bbcaad..3ceb487 100644 (file)
@@ -15,9 +15,9 @@
 
 #include <stdio.h>
 #include <string.h>
 
 #include <stdio.h>
 #include <string.h>
-#include <ctype.h>
 
 #include <yaz/querytowrbuf.h>
 
 #include <yaz/querytowrbuf.h>
+#include <yaz/yaz-iconv.h>
 #include <yaz/ccl.h>
 
 static void ccl_pquery_indent(WRBUF w, struct ccl_rpn_node *p, int indent);
 #include <yaz/ccl.h>
 
 static void ccl_pquery_indent(WRBUF w, struct ccl_rpn_node *p, int indent);
@@ -45,7 +45,7 @@ static void ccl_pquery_complex(WRBUF w, struct ccl_rpn_node *p, int indent)
             if (*cp == '!')
             {   
                 /* word order specified */
             if (*cp == '!')
             {   
                 /* word order specified */
-                if (isdigit(((const unsigned char *) cp)[1]))
+                if (yaz_isdigit(cp[1]))
                     wrbuf_printf(w, "@prox 0 %s 1 2 k 2", cp+1);
                 else
                     wrbuf_printf(w, "@prox 0 1 1 2 k 2");
                     wrbuf_printf(w, "@prox 0 %s 1 2 k 2", cp+1);
                 else
                     wrbuf_printf(w, "@prox 0 1 1 2 k 2");
@@ -53,7 +53,7 @@ static void ccl_pquery_complex(WRBUF w, struct ccl_rpn_node *p, int indent)
             else if (*cp == '%')
             {
                 /* word order not specified */
             else if (*cp == '%')
             {
                 /* word order not specified */
-                if (isdigit(((const unsigned char *) cp)[1]))
+                if (yaz_isdigit(cp[1]))
                     wrbuf_printf(w, "@prox 0 %s 0 2 k 2", cp+1);
                 else
                     wrbuf_printf(w, "@prox 0 1 0 2 k 2");
                     wrbuf_printf(w, "@prox 0 %s 0 2 k 2", cp+1);
                 else
                     wrbuf_printf(w, "@prox 0 1 0 2 k 2");
index 7c1e3e9..a970643 100644 (file)
@@ -9,7 +9,7 @@
 #if HAVE_CONFIG_H
 #include <config.h>
 #endif
 #if HAVE_CONFIG_H
 #include <config.h>
 #endif
-#include <ctype.h>
+#include <yaz/yaz-iconv.h>
 #include <stdio.h>
 #include <stdlib.h>
 
 #include <stdio.h>
 #include <stdlib.h>
 
 
 static int ccli_toupper (int c)
 {
 
 static int ccli_toupper (int c)
 {
-    return toupper (c);
+    if (yaz_islower(c))
+        return yaz_toupper(c);
+    else
+        return c;
 }
 
 int (*ccl_toupper)(int c) = NULL;
 }
 
 int (*ccl_toupper)(int c) = NULL;
index db5d9c9..538cd56 100644 (file)
@@ -12,8 +12,7 @@
 
 #include <string.h>
 #include <stdlib.h>
 
 #include <string.h>
 #include <stdlib.h>
-#include <ctype.h>
-
+#include <yaz/yaz-iconv.h>
 #include "cclp.h"
 
 /*
 #include "cclp.h"
 
 /*
@@ -105,7 +104,7 @@ struct ccl_token *ccl_parser_tokenize(CCL_parser cclp, const char *command)
         case '%':
         case '!':
             last->kind = CCL_TOK_PROX;
         case '%':
         case '!':
             last->kind = CCL_TOK_PROX;
-            while (isdigit(*cp))
+            while (yaz_isdigit(*cp))
             {
                 ++ last->len;
                 cp++;
             {
                 ++ last->len;
                 cp++;
index 496fe22..669117d 100644 (file)
@@ -11,9 +11,9 @@
 #endif
 
 #include <string.h>
 #endif
 
 #include <string.h>
-#include <ctype.h>
 #include <errno.h>
 
 #include <errno.h>
 
+#include <yaz/yaz-iconv.h>
 #include <yaz/log.h>
 #include <yaz/comstack.h>
 #include <yaz/tcpip.h>
 #include <yaz/log.h>
 #include <yaz/comstack.h>
 #include <yaz/tcpip.h>
@@ -234,13 +234,13 @@ static int cs_read_chunk(const char *buf, int i, int len)
                 printf ("i=%d len=%d\n", i, len);
 #endif
                 return 0;
                 printf ("i=%d len=%d\n", i, len);
 #endif
                 return 0;
-            } else if (isdigit(buf[i]))
+            } else if (yaz_isdigit(buf[i]))
                 chunk_len = chunk_len * 16 + 
                     (buf[i++] - '0');
                 chunk_len = chunk_len * 16 + 
                     (buf[i++] - '0');
-            else if (isupper(buf[i]))
+            else if (yaz_isupper(buf[i]))
                 chunk_len = chunk_len * 16 + 
                     (buf[i++] - ('A'-10));
                 chunk_len = chunk_len * 16 + 
                     (buf[i++] - ('A'-10));
-            else if (islower(buf[i]))
+            else if (yaz_islower(buf[i]))
                 chunk_len = chunk_len * 16 + 
                     (buf[i++] - ('a'-10));
             else
                 chunk_len = chunk_len * 16 + 
                     (buf[i++] - ('a'-10));
             else
@@ -345,7 +345,7 @@ static int cs_complete_http(const char *buf, int len, int head_only)
                 while (buf[i] == ' ')
                     i++;
                 content_len = 0;
                 while (buf[i] == ' ')
                     i++;
                 content_len = 0;
-                while (i <= len-4 && isdigit(buf[i]))
+                while (i <= len-4 && yaz_isdigit(buf[i]))
                     content_len = content_len*10 + (buf[i++] - '0');
                 if (content_len < 0) /* prevent negative offsets */
                     content_len = 0;
                     content_len = content_len*10 + (buf[i++] - '0');
                 if (content_len < 0) /* prevent negative offsets */
                     content_len = 0;
index 7bb83f8..d102a17 100644 (file)
--- a/src/cql.y
+++ b/src/cql.y
@@ -17,7 +17,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
+#include <yaz/yaz-iconv.h>
 #include <yaz/xmalloc.h>
 #include <yaz/nmem.h>
 #include <yaz/cql.h>
 #include <yaz/xmalloc.h>
 #include <yaz/nmem.h>
 #include <yaz/cql.h>
@@ -266,7 +266,7 @@ int yylex(YYSTYPE *lval, void *vp)
             return 0;
         if (c == '\n')
             return 0;
             return 0;
         if (c == '\n')
             return 0;
-    } while (isspace(c));
+    } while (yaz_isspace(c));
     if (strchr("()=></", c))
     {
         int c1;
     if (strchr("()=></", c))
     {
         int c1;
index a07894e..35101ae 100644 (file)
@@ -23,7 +23,6 @@
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
 #include <yaz/rpn2cql.h>
 #include <yaz/xmalloc.h>
 #include <yaz/diagsrw.h>
 #include <yaz/rpn2cql.h>
 #include <yaz/xmalloc.h>
 #include <yaz/diagsrw.h>
@@ -138,7 +137,7 @@ static int cql_transform_parse_tok_line(cql_transform_t ct,
             break;
         }
         value_str = yaz_tok_parse_string(tp);
             break;
         }
         value_str = yaz_tok_parse_string(tp);
-        if (isdigit(*value_str))
+        if (yaz_isdigit(*value_str))
         {
             elem->which = Z_AttributeValue_numeric;
             elem->value.numeric =
         {
             elem->which = Z_AttributeValue_numeric;
             elem->value.numeric =
index 29b6304..f01fab8 100644 (file)
@@ -13,7 +13,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include <ctype.h>
 
 #include <yaz/proto.h>
 #include <yaz/oid_db.h>
 
 #include <yaz/proto.h>
 #include <yaz/oid_db.h>
index 0fb1434..3f8fb53 100644 (file)
@@ -10,7 +10,6 @@
 #include <config.h>
 #endif
 
 #include <config.h>
 #endif
 
-#include <ctype.h>
 #include <yaz/odr.h>
 #include <yaz/yaz-version.h>
 #include <yaz/yaz-iconv.h>
 #include <yaz/odr.h>
 #include <yaz/yaz-version.h>
 #include <yaz/yaz-iconv.h>
@@ -143,13 +142,13 @@ static int decode_headers_content(ODR o, int off, Z_HTTP_Header **headers,
             /* chunk length .. */
             int chunk_len = 0;
             for (; i  < o->size-2; i++)
             /* chunk length .. */
             int chunk_len = 0;
             for (; i  < o->size-2; i++)
-                if (isdigit(o->buf[i]))
+                if (yaz_isdigit(o->buf[i]))
                     chunk_len = chunk_len * 16 + 
                         (o->buf[i] - '0');
                     chunk_len = chunk_len * 16 + 
                         (o->buf[i] - '0');
-                else if (isupper(o->buf[i]))
+                else if (yaz_isupper(o->buf[i]))
                     chunk_len = chunk_len * 16 + 
                         (o->buf[i] - ('A'-10));
                     chunk_len = chunk_len * 16 + 
                         (o->buf[i] - ('A'-10));
-                else if (islower(o->buf[i]))
+                else if (yaz_islower(o->buf[i]))
                     chunk_len = chunk_len * 16 + 
                         (o->buf[i] - ('a'-10));
                 else
                     chunk_len = chunk_len * 16 + 
                         (o->buf[i] - ('a'-10));
                 else
index 7e86c0d..aba40be 100644 (file)
@@ -15,7 +15,6 @@
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
-#include <ctype.h>
 #include <stdio.h>
 #include <yaz/log.h>
 #include <yaz/xmalloc.h>
 #include <stdio.h>
 #include <yaz/log.h>
 #include <yaz/xmalloc.h>
index 33847bc..4938e51 100644 (file)
@@ -21,7 +21,6 @@
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
-#include <ctype.h>
 
 #include <yaz/xmalloc.h>
 #include "iconv-p.h"
 
 #include <yaz/xmalloc.h>
 #include "iconv-p.h"
index 7b31510..915a68c 100644 (file)
@@ -17,7 +17,6 @@
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
-#include <ctype.h>
 
 #include <yaz/xmalloc.h>
 #include "iconv-p.h"
 
 #include <yaz/xmalloc.h>
 #include "iconv-p.h"
index 20b6505..32befea 100644 (file)
@@ -15,7 +15,6 @@
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
-#include <ctype.h>
 
 #include <yaz/xmalloc.h>
 #include "iconv-p.h"
 
 #include <yaz/xmalloc.h>
 #include "iconv-p.h"
index 2d7b694..6e753f1 100644 (file)
@@ -17,7 +17,6 @@
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
-#include <ctype.h>
 
 #include <yaz/xmalloc.h>
 #include <yaz/snprintf.h>
 
 #include <yaz/xmalloc.h>
 #include <yaz/snprintf.h>
index 41b4492..a39a36c 100644 (file)
@@ -14,7 +14,6 @@
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
-#include <ctype.h>
 #if HAVE_WCHAR_H
 #include <wchar.h>
 #endif
 #if HAVE_WCHAR_H
 #include <wchar.h>
 #endif
index 5f22b24..f357187 100644 (file)
@@ -14,7 +14,6 @@
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
-#include <ctype.h>
 
 #include "iconv-p.h"
 
 
 #include "iconv-p.h"
 
index b68e308..28ffba5 100644 (file)
--- a/src/log.c
+++ b/src/log.c
 #endif
 #include <stdio.h>
 #include <stdlib.h>
 #endif
 #include <stdio.h>
 #include <stdlib.h>
-#include <ctype.h>
 #include <string.h>
 #include <stdarg.h>
 #include <errno.h>
 #include <time.h>
 #include <string.h>
 #include <stdarg.h>
 #include <errno.h>
 #include <time.h>
+#include <yaz/yaz-iconv.h>
 #include <yaz/errno.h>
 #include <yaz/thread_id.h>
 #include <yaz/log.h>
 #include <yaz/errno.h>
 #include <yaz/thread_id.h>
 #include <yaz/log.h>
@@ -575,7 +575,7 @@ int yaz_log_mask_str_x(const char *str, int level)
             negated = 1;
             str++;
         }
             negated = 1;
             str++;
         }
-        if (isdigit(*(unsigned char *) str))
+        if (yaz_isdigit(*str))
         {
             level = atoi(str);
         }
         {
             level = atoi(str);
         }
index dd20fc8..608a1e4 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <stdio.h>
 #include <string.h>
 
 #include <stdio.h>
 #include <string.h>
-#include <ctype.h>
 #include <yaz/marcdisp.h>
 #include <yaz/wrbuf.h>
 #include <yaz/yaz-util.h>
 #include <yaz/marcdisp.h>
 #include <yaz/wrbuf.h>
 #include <yaz/yaz-util.h>
@@ -90,7 +89,7 @@ int yaz_marc_read_iso2709(yaz_marc_t mt, const char *buf, int bsize)
         }
         /* Check for digits in length+starting info */
         while (--l >= 3)
         }
         /* Check for digits in length+starting info */
         while (--l >= 3)
-            if (!isdigit(*(const unsigned char *) (buf + entry_p+l)))
+            if (!yaz_isdigit(buf[entry_p + l]))
                 break;
         if (l >= 3)
         {
                 break;
         if (l >= 3)
         {
index 82f455f..2137197 100644 (file)
@@ -19,7 +19,6 @@
 #include <assert.h>
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
 #include <stdio.h>
 #include <string.h>
-#include <ctype.h>
 
 #include <yaz/marcdisp.h>
 #include <yaz/wrbuf.h>
 
 #include <yaz/marcdisp.h>
 #include <yaz/wrbuf.h>
index a81e8c4..709c8a0 100644 (file)
@@ -18,7 +18,6 @@
 
 #include <stdio.h>
 #include <string.h>
 
 #include <stdio.h>
 #include <string.h>
-#include <ctype.h>
 #include <yaz/marcdisp.h>
 #include <yaz/wrbuf.h>
 #include <yaz/yaz-util.h>
 #include <yaz/marcdisp.h>
 #include <yaz/wrbuf.h>
 #include <yaz/yaz-util.h>
index 00d1ed8..8f9bcc3 100644 (file)
@@ -20,7 +20,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
 #include <yaz/marcdisp.h>
 #include <yaz/wrbuf.h>
 #include <yaz/yaz-util.h>
 #include <yaz/marcdisp.h>
 #include <yaz/wrbuf.h>
 #include <yaz/yaz-util.h>
index 8fe4a2e..696a4a8 100644 (file)
@@ -12,7 +12,6 @@
 
 #include <assert.h>
 #include <stdlib.h>
 
 #include <assert.h>
 #include <stdlib.h>
-#include <ctype.h>
 #include <string.h>
 
 #include <yaz/xmalloc.h>
 #include <string.h>
 
 #include <yaz/xmalloc.h>
index 15296cc..ce9521c 100644 (file)
@@ -14,8 +14,8 @@
 
 #include <stdio.h>
 #include <assert.h>
 
 #include <stdio.h>
 #include <assert.h>
-#include <ctype.h>
 #include <string.h>
 #include <string.h>
+#include <yaz/yaz-iconv.h>
 #include <yaz/matchstr.h>
 
 int yaz_matchstr(const char *s1, const char *s2)
 #include <yaz/matchstr.h>
 
 int yaz_matchstr(const char *s1, const char *s2)
@@ -35,10 +35,10 @@ int yaz_matchstr(const char *s1, const char *s2)
             break;
         if (c2 != '.')
         {
             break;
         if (c2 != '.')
         {
-            if (isupper(c1))
-                c1 = tolower(c1);
-            if (isupper(c2))
-                c2 = tolower(c2);
+            if (yaz_isupper(c1))
+                c1 = yaz_tolower(c1);
+            if (yaz_isupper(c2))
+                c2 = yaz_tolower(c2);
             if (c1 != c2)
                 break;
         }
             if (c1 != c2)
                 break;
         }
index 88dee67..f2421d1 100644 (file)
@@ -13,7 +13,6 @@
 
 #include <stdio.h>
 #include <string.h>
 
 #include <stdio.h>
 #include <string.h>
-#include <ctype.h>
 #include <yaz/xmalloc.h>
 
 #include "mime.h"
 #include <yaz/xmalloc.h>
 
 #include "mime.h"
index 238f1be..aea6a4a 100644 (file)
@@ -12,7 +12,6 @@
 
 #include <stdlib.h>
 #include <string.h>
 
 #include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
 #include "odr-priv.h"
 #include <yaz/oid_util.h>
 
 #include "odr-priv.h"
 #include <yaz/oid_util.h>
 
index 5d9297e..3b27864 100644 (file)
@@ -13,7 +13,6 @@
 
 #include <stdlib.h>
 #include <string.h>
 
 #include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
 
 #include <yaz/yaz-util.h>
 #include <yaz/odr.h>
 
 #include <yaz/yaz-util.h>
 #include <yaz/odr.h>
index 58c3a35..6158d3c 100644 (file)
@@ -14,8 +14,8 @@
 
 #include <stdlib.h>
 #include <string.h>
 
 #include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
 
 
+#include <yaz/yaz-iconv.h>
 #include <yaz/snprintf.h>
 #include <yaz/oid_util.h>
 
 #include <yaz/snprintf.h>
 #include <yaz/oid_util.h>
 
@@ -76,7 +76,7 @@ int oid_dotstring_to_oid(const char *name, Odr_oid *oid)
 {
     int i = 0;
     int val = 0;
 {
     int i = 0;
     int val = 0;
-    while (isdigit (*(unsigned char *) name))
+    while (yaz_isdigit (*name))
     {
         val = val*10 + (*name - '0');
         name++;
     {
         val = val*10 + (*name - '0');
         name++;
index 735d969..4700a35 100644 (file)
@@ -13,7 +13,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include <ctype.h>
 
 #include <yaz/proto.h>
 #include <yaz/marcdisp.h>
 
 #include <yaz/proto.h>
 #include <yaz/marcdisp.h>
index 1a45b40..dceed33 100644 (file)
@@ -13,7 +13,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include <ctype.h>
 
 #include <yaz/proto.h>
 #include <yaz/oid_db.h>
 
 #include <yaz/proto.h>
 #include <yaz/oid_db.h>
@@ -77,7 +76,7 @@ static int query_token(struct yaz_pqf_parser *li)
     }
     li->lex_buf = *qptr;
    
     }
     li->lex_buf = *qptr;
    
-    if (**qptr == li->escape_char && isdigit(((const unsigned char *) *qptr)[1]))
+    if (**qptr == li->escape_char && yaz_isdigit((*qptr)[1]))
     {
         ++(li->lex_len);
         ++(*qptr);
     {
         ++(li->lex_len);
         ++(*qptr);
index 7a9c282..4d9bd05 100644 (file)
@@ -13,7 +13,6 @@
 #endif
 
 #include <stdio.h>
 #endif
 
 #include <stdio.h>
-#include <ctype.h>
 
 #include <yaz/log.h>
 #include <yaz/readconf.h>
 
 #include <yaz/log.h>
 #include <yaz/readconf.h>
index 1d709aa..2afbb4b 100644 (file)
@@ -33,7 +33,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <assert.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <assert.h>
-#include <ctype.h>
 
 #if HAVE_SYS_TYPES_H
 #include <sys/types.h>
 
 #if HAVE_SYS_TYPES_H
 #include <sys/types.h>
@@ -1920,7 +1919,7 @@ static void process_http_request(association *assoc, request *req)
         int t;
         const char *alive = z_HTTP_header_lookup(hreq->headers, "Keep-Alive");
 
         int t;
         const char *alive = z_HTTP_header_lookup(hreq->headers, "Keep-Alive");
 
-        if (alive && isdigit(*(const unsigned char *) alive))
+        if (alive && yaz_isdigit(*(const unsigned char *) alive))
             t = atoi(alive);
         else
             t = 15;
             t = atoi(alive);
         else
             t = 15;
index 6a2618c..9ae3c39 100644 (file)
@@ -20,7 +20,6 @@
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
-#include <ctype.h>
 
 #if HAVE_ICONV_H
 #include <iconv.h>
 
 #if HAVE_ICONV_H
 #include <iconv.h>
index d2732e5..4ce5a95 100644 (file)
@@ -13,7 +13,6 @@
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
 #include <yaz/rpn2solr.h>
 #include <yaz/xmalloc.h>
 #include <yaz/diagsrw.h>
 #include <yaz/rpn2solr.h>
 #include <yaz/xmalloc.h>
 #include <yaz/diagsrw.h>
@@ -160,7 +159,7 @@ static int solr_transform_parse_tok_line(solr_transform_t ct,
             break;
         }
         value_str = yaz_tok_parse_string(tp);
             break;
         }
         value_str = yaz_tok_parse_string(tp);
-        if (isdigit(*value_str))
+        if (yaz_isdigit(*value_str))
         {
             elem->which = Z_AttributeValue_numeric;
             elem->value.numeric =
         {
             elem->which = Z_AttributeValue_numeric;
             elem->value.numeric =
index 7560058..487153e 100644 (file)
@@ -15,7 +15,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
 
 #ifdef WIN32
 #include <process.h>
 
 #ifdef WIN32
 #include <process.h>
@@ -64,6 +63,7 @@
 #include "session.h"
 #include <yaz/statserv.h>
 #include <yaz/daemon.h>
 #include "session.h"
 #include <yaz/statserv.h>
 #include <yaz/daemon.h>
+#include <yaz/yaz-iconv.h>
 
 static IOCHAN pListener = NULL;
 
 
 static IOCHAN pListener = NULL;
 
@@ -195,7 +195,7 @@ static char *nmem_dup_xml_content(NMEM n, xmlNodePtr ptr)
             cp = p->content;
             if (first)
             {
             cp = p->content;
             if (first)
             {
-                while(*cp && isspace(*cp))
+                while(*cp && yaz_isspace(*cp))
                     cp++;
                 if (*cp)
                     first = 0;  /* reset if we got non-whitespace out */
                     cp++;
                 if (*cp)
                     first = 0;  /* reset if we got non-whitespace out */
@@ -205,7 +205,7 @@ static char *nmem_dup_xml_content(NMEM n, xmlNodePtr ptr)
     }
     /* remove trailing whitespace */
     cp = strlen((const char *)str) + str;
     }
     /* remove trailing whitespace */
     cp = strlen((const char *)str) + str;
-    while (cp != str && isspace(cp[-1]))
+    while (cp != str && yaz_isspace(cp[-1]))
         cp--;
     *cp = '\0';
     /* return resulting string */
         cp--;
     *cp = '\0';
     /* return resulting string */
index 108de00..5f783be 100644 (file)
@@ -13,7 +13,6 @@
 #include <assert.h>
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
 #include <stdio.h>
 #include <string.h>
-#include <ctype.h>
 #include <yaz/log.h>
 #include <yaz/wrbuf.h>
 #include <yaz/tokenizer.h>
 #include <yaz/log.h>
 #include <yaz/wrbuf.h>
 #include <yaz/tokenizer.h>
index 67b823a..a58bb3a 100644 (file)
@@ -14,7 +14,6 @@
 
 #include <stdio.h>
 #include <string.h>
 
 #include <stdio.h>
 #include <string.h>
-#include <ctype.h>
 #include <yaz/tpath.h>
 #include <yaz/log.h>
 #if HAVE_SYS_TYPES_H
 #include <yaz/tpath.h>
 #include <yaz/log.h>
 #if HAVE_SYS_TYPES_H
index 1b10e30..3b50dec 100644 (file)
@@ -14,7 +14,6 @@
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
-#include <ctype.h>
 
 #include "iconv-p.h"
 
 
 #include "iconv-p.h"
 
index ea1a5b0..8911683 100644 (file)
@@ -14,7 +14,6 @@
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
-#include <ctype.h>
 
 #include "iconv-p.h"
 
 
 #include "iconv-p.h"
 
index ddac41d..ee7a098 100644 (file)
@@ -13,7 +13,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
 
 #include <yaz/yaz-ccl.h>
 #include <yaz/pquery.h>
 
 #include <yaz/yaz-ccl.h>
 #include <yaz/pquery.h>
index 6812e38..1526dc8 100644 (file)
@@ -10,7 +10,6 @@
 #include <errno.h>
 #include <string.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
 #include <stdlib.h>
-#include <ctype.h>
 
 #include <yaz/file_glob.h>
 #include <yaz/test.h>
 
 #include <yaz/file_glob.h>
 #include <yaz/test.h>
index c816034..71431e8 100644 (file)
@@ -10,7 +10,6 @@
 #include <errno.h>
 #include <string.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
 #include <stdlib.h>
-#include <ctype.h>
 
 #include <yaz/tpath.h>
 #include <yaz/test.h>
 
 #include <yaz/tpath.h>
 #include <yaz/test.h>
index 3c730cf..2a533bb 100644 (file)
@@ -9,7 +9,6 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
-#include <ctype.h>
 
 #include <yaz/yaz-util.h>
 #include <yaz/test.h>
 
 #include <yaz/yaz-util.h>
 #include <yaz/test.h>
index cd47192..61c0739 100644 (file)
@@ -10,7 +10,6 @@
 #include <errno.h>
 #include <string.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
 #include <stdlib.h>
-#include <ctype.h>
 
 #include <yaz/nmem.h>
 #include <yaz/test.h>
 
 #include <yaz/nmem.h>
 #include <yaz/test.h>
index 3d4a1f0..0d9d211 100644 (file)
@@ -10,7 +10,6 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
-#include <ctype.h>
 
 #include <yaz/yaz-util.h>
 
 
 #include <yaz/yaz-util.h>
 
index 25c6759..83020e6 100644 (file)
@@ -2,18 +2,19 @@
  * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
  * Copyright (C) 1995-2011 Index Data
  * See the file LICENSE for details.
  */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
 #include <sys/time.h>
 
 #include <yaz/xmalloc.h>
 #include <yaz/options.h>
 #include <yaz/zoom.h>
 
 #include <sys/time.h>
 
 #include <yaz/xmalloc.h>
 #include <yaz/options.h>
 #include <yaz/zoom.h>
 
-
 /* naming events */
 static char* zoom_events[ZOOM_EVENT_MAX+1];
 
 /* naming events */
 static char* zoom_events[ZOOM_EVENT_MAX+1];
 
index 461e848..530e08e 100644 (file)
@@ -12,7 +12,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
 #include <yaz/wrbuf.h>
 #include <yaz/log.h>
 
 #include <yaz/wrbuf.h>
 #include <yaz/log.h>
 
index 7c2f751..7366f94 100644 (file)
@@ -6,7 +6,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <ctype.h>
+#include <yaz/yaz-iconv.h>
 
 #include <yaz/xmalloc.h>
 
 
 #include <yaz/xmalloc.h>
 
@@ -27,7 +27,7 @@ int main(int argc, char **argv)
                          "%s number target query\n", *argv, *argv);
         exit (1);
     }
                          "%s number target query\n", *argv, *argv);
         exit (1);
     }
-    if (argc == 4 && isdigit(argv[1][0]) && !strchr(argv[1],'.'))
+    if (argc == 4 && yaz_isdigit(argv[1][0]) && !strchr(argv[1],'.'))
     {
         no = atoi(argv[1]);
         same_target = 1;
     {
         no = atoi(argv[1]);
         same_target = 1;
index 50af043..e3d96d0 100644 (file)
@@ -9,7 +9,6 @@
 #include <config.h>
 #endif
 
 #include <config.h>
 #endif
 
-#include <ctype.h>
 #include <yaz/wrbuf.h>
 #include <yaz/marcdisp.h>
 #include <yaz/odr.h>
 #include <yaz/wrbuf.h>
 #include <yaz/marcdisp.h>
 #include <yaz/odr.h>
index 2aa5d8e..55e0cb7 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <ctype.h>
 
 #include <yaz/log.h>
 #include <yaz/backend.h>
 
 #include <yaz/log.h>
 #include <yaz/backend.h>
index 162f9ab..2943782 100644 (file)
@@ -10,7 +10,6 @@
 #endif
 
 #include <stdio.h>
 #endif
 
 #include <stdio.h>
-#include <ctype.h>
 #include <stdlib.h>
 
 #include <yaz/proto.h>
 #include <stdlib.h>
 
 #include <yaz/proto.h>
@@ -34,7 +33,7 @@ static Z_GenericRecord *read_grs1(FILE *f, ODR o)
 
         while (fgets(buf = line, 512, f))
         {
 
         while (fgets(buf = line, 512, f))
         {
-            while (*buf && isspace(*(unsigned char *) buf))
+            while (*buf && yaz_isspace(*buf))
                 buf++;
             if (!*buf || *buf == '#')
                 continue;
                 buf++;
             if (!*buf || *buf == '#')
                 continue;
@@ -52,7 +51,7 @@ static Z_GenericRecord *read_grs1(FILE *f, ODR o)
         if (!(buf = strchr(buf, ')')))
             return 0;
         buf++;
         if (!(buf = strchr(buf, ')')))
             return 0;
         buf++;
-        while (*buf && isspace(*(unsigned char *) buf))
+        while (*buf && yaz_isspace(*buf))
             buf++;
         if (!*buf)
             return 0;
             buf++;
         if (!*buf)
             return 0;
index 3737554..4767f78 100644 (file)
@@ -9,7 +9,6 @@
 #include <config.h>
 #endif
 
 #include <config.h>
 #endif
 
-#include <ctype.h>
 #include <yaz/wrbuf.h>
 #include <yaz/marcdisp.h>
 #include <yaz/odr.h>
 #include <yaz/wrbuf.h>
 #include <yaz/marcdisp.h>
 #include <yaz/odr.h>
index 88e0a21..3c96d91 100644 (file)
@@ -13,7 +13,6 @@
 #include <stdio.h>
 #include <math.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <math.h>
 #include <stdlib.h>
-#include <ctype.h>
 
 #if HAVE_SYS_TIME_H
 #include <sys/time.h>
 
 #if HAVE_SYS_TIME_H
 #include <sys/time.h>
@@ -1010,8 +1009,8 @@ int ztest_scan(void *handle, bend_scan_rr *q)
         strcpy(term, "0");
 
     for (p = term; *p; p++)
         strcpy(term, "0");
 
     for (p = term; *p; p++)
-        if (islower(*(unsigned char *) p))
-            *p = toupper(*p);
+        if (yaz_islower(*p))
+            *p = yaz_toupper(*p);
 
     fseek(f, 0, SEEK_SET);
     q->num_entries = 0;
 
     fseek(f, 0, SEEK_SET);
     q->num_entries = 0;