]> sjero.net Git - wget/commitdiff
[svn] Punish the *use* of ctype macros, rather than their mere presence.
authorhniksic <devnull@localhost>
Fri, 27 Apr 2001 05:03:08 +0000 (22:03 -0700)
committerhniksic <devnull@localhost>
Fri, 27 Apr 2001 05:03:08 +0000 (22:03 -0700)
Published in <sxssnivlyut.fsf@florida.arsdigita.de>.

src/ChangeLog
src/safe-ctype.h

index dba698e620660dd5881e5e59290e23b42873271c..752155a0d42e11ad35ccb820ef0c1e58ff33696f 100644 (file)
@@ -1,3 +1,10 @@
+2001-04-27  Hrvoje Niksic  <hniksic@arsdigita.com>
+
+       * safe-ctype.h: Instead of throwing #error when isalpha is
+       defined, redefine it to something that will throw a compile-time
+       error if actually *used*.  Do the same for the rest of the
+       standard C macros.
+
 2001-04-26  Hrvoje Niksic  <hniksic@arsdigita.com>
 
        * url.c (getproxy): Ignore empty proxy vars.
index d5fc649051a3c10ed62acfe0de16f4dc3be3d968..72413f78287c49bf234192fdc1d517c3f99e70cf 100644 (file)
@@ -35,9 +35,38 @@ Boston, MA 02111-1307, USA.  */
 #ifndef SAFE_CTYPE_H
 #define SAFE_CTYPE_H
 
-#ifdef isalpha
- #error "safe-ctype.h and ctype.h may not be used simultaneously"
-#else
+/* Catch erroneous use of ctype macros.  Files that really know what
+   they're doing can disable this check by defining the
+   I_REALLY_WANT_CTYPE_MACROS preprocessor constant. */
+
+#ifndef I_REALLY_WANT_CTYPE_MACROS
+
+#undef isalpha
+#define isalpha *** Please use ISALPHA ***
+#undef isalnum
+#define isalnum *** Please use ISALNUM ***
+#undef isblank
+#define isblank *** Please use ISBLANK ***
+#undef iscntrl
+#define iscntrl *** Please use ISCNTRL ***
+#undef isdigit
+#define isdigit *** Please use ISDIGIT ***
+#undef isgraph
+#define isgraph *** Please use ISGRAPH ***
+#undef islower
+#define islower *** Please use ISLOWER ***
+#undef isprint
+#define isprint *** Please use ISPRINT ***
+#undef ispunct
+#define ispunct *** Please use ISPUNCT ***
+#undef isspace
+#define isspace *** Please use ISSPACE ***
+#undef isupper
+#define isupper *** Please use ISUPPER ***
+#undef isxdigit
+#define isxdigit *** Please use ISXDIGIT ***
+
+#endif /* I_REALLY_WANT_CTYPE_MACROS */
 
 /* Categories.  */
 
@@ -96,5 +125,4 @@ extern const unsigned char  _sch_tolower[256];
 #define TOUPPER(c) _sch_toupper[(c) & 0xff]
 #define TOLOWER(c) _sch_tolower[(c) & 0xff]
 
-#endif /* no ctype.h */
 #endif /* SAFE_CTYPE_H */