diff options
Diffstat (limited to 'src/regex.c')
| -rw-r--r-- | src/regex.c | 69 |
1 files changed, 18 insertions, 51 deletions
diff --git a/src/regex.c b/src/regex.c index 625c59ccf0b..190d1d0fe21 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -37,9 +37,9 @@ | |||
| 37 | # include <config.h> | 37 | # include <config.h> |
| 38 | #endif | 38 | #endif |
| 39 | 39 | ||
| 40 | #if defined STDC_HEADERS && !defined emacs | 40 | #include <stddef.h> |
| 41 | # include <stddef.h> | 41 | |
| 42 | #else | 42 | #ifdef emacs |
| 43 | /* We need this for `regex.h', and perhaps for the Emacs include files. */ | 43 | /* We need this for `regex.h', and perhaps for the Emacs include files. */ |
| 44 | # include <sys/types.h> | 44 | # include <sys/types.h> |
| 45 | #endif | 45 | #endif |
| @@ -238,18 +238,7 @@ xrealloc (void *block, size_t size) | |||
| 238 | # endif | 238 | # endif |
| 239 | # define realloc xrealloc | 239 | # define realloc xrealloc |
| 240 | 240 | ||
| 241 | /* This is the normal way of making sure we have memcpy, memcmp and memset. */ | 241 | # include <string.h> |
| 242 | # if defined HAVE_STRING_H || defined STDC_HEADERS || defined _LIBC | ||
| 243 | # include <string.h> | ||
| 244 | # else | ||
| 245 | # include <strings.h> | ||
| 246 | # ifndef memcmp | ||
| 247 | # define memcmp(s1, s2, n) bcmp (s1, s2, n) | ||
| 248 | # endif | ||
| 249 | # ifndef memcpy | ||
| 250 | # define memcpy(d, s, n) (bcopy (s, d, n), (d)) | ||
| 251 | # endif | ||
| 252 | # endif | ||
| 253 | 242 | ||
| 254 | /* Define the syntax stuff for \<, \>, etc. */ | 243 | /* Define the syntax stuff for \<, \>, etc. */ |
| 255 | 244 | ||
| @@ -357,25 +346,6 @@ enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 }; | |||
| 357 | 346 | ||
| 358 | #else /* not emacs */ | 347 | #else /* not emacs */ |
| 359 | 348 | ||
| 360 | /* Jim Meyering writes: | ||
| 361 | |||
| 362 | "... Some ctype macros are valid only for character codes that | ||
| 363 | isascii says are ASCII (SGI's IRIX-4.0.5 is one such system --when | ||
| 364 | using /bin/cc or gcc but without giving an ansi option). So, all | ||
| 365 | ctype uses should be through macros like ISPRINT... If | ||
| 366 | STDC_HEADERS is defined, then autoconf has verified that the ctype | ||
| 367 | macros don't need to be guarded with references to isascii. ... | ||
| 368 | Defining isascii to 1 should let any compiler worth its salt | ||
| 369 | eliminate the && through constant folding." | ||
| 370 | Solaris defines some of these symbols so we must undefine them first. */ | ||
| 371 | |||
| 372 | # undef ISASCII | ||
| 373 | # if defined STDC_HEADERS || (!defined isascii && !defined HAVE_ISASCII) | ||
| 374 | # define ISASCII(c) 1 | ||
| 375 | # else | ||
| 376 | # define ISASCII(c) isascii(c) | ||
| 377 | # endif | ||
| 378 | |||
| 379 | /* 1 if C is an ASCII character. */ | 349 | /* 1 if C is an ASCII character. */ |
| 380 | # define IS_REAL_ASCII(c) ((c) < 0200) | 350 | # define IS_REAL_ASCII(c) ((c) < 0200) |
| 381 | 351 | ||
| @@ -383,27 +353,28 @@ enum syntaxcode { Swhitespace = 0, Sword = 1, Ssymbol = 2 }; | |||
| 383 | # define ISUNIBYTE(c) 1 | 353 | # define ISUNIBYTE(c) 1 |
| 384 | 354 | ||
| 385 | # ifdef isblank | 355 | # ifdef isblank |
| 386 | # define ISBLANK(c) (ISASCII (c) && isblank (c)) | 356 | # define ISBLANK(c) isblank (c) |
| 387 | # else | 357 | # else |
| 388 | # define ISBLANK(c) ((c) == ' ' || (c) == '\t') | 358 | # define ISBLANK(c) ((c) == ' ' || (c) == '\t') |
| 389 | # endif | 359 | # endif |
| 390 | # ifdef isgraph | 360 | # ifdef isgraph |
| 391 | # define ISGRAPH(c) (ISASCII (c) && isgraph (c)) | 361 | # define ISGRAPH(c) isgraph (c) |
| 392 | # else | 362 | # else |
| 393 | # define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c)) | 363 | # define ISGRAPH(c) (isprint (c) && !isspace (c)) |
| 394 | # endif | 364 | # endif |
| 395 | 365 | ||
| 366 | /* Solaris defines ISPRINT so we must undefine it first. */ | ||
| 396 | # undef ISPRINT | 367 | # undef ISPRINT |
| 397 | # define ISPRINT(c) (ISASCII (c) && isprint (c)) | 368 | # define ISPRINT(c) isprint (c) |
| 398 | # define ISDIGIT(c) (ISASCII (c) && isdigit (c)) | 369 | # define ISDIGIT(c) isdigit (c) |
| 399 | # define ISALNUM(c) (ISASCII (c) && isalnum (c)) | 370 | # define ISALNUM(c) isalnum (c) |
| 400 | # define ISALPHA(c) (ISASCII (c) && isalpha (c)) | 371 | # define ISALPHA(c) isalpha (c) |
| 401 | # define ISCNTRL(c) (ISASCII (c) && iscntrl (c)) | 372 | # define ISCNTRL(c) iscntrl (c) |
| 402 | # define ISLOWER(c) (ISASCII (c) && islower (c)) | 373 | # define ISLOWER(c) islower (c) |
| 403 | # define ISPUNCT(c) (ISASCII (c) && ispunct (c)) | 374 | # define ISPUNCT(c) ispunct (c) |
| 404 | # define ISSPACE(c) (ISASCII (c) && isspace (c)) | 375 | # define ISSPACE(c) isspace (c) |
| 405 | # define ISUPPER(c) (ISASCII (c) && isupper (c)) | 376 | # define ISUPPER(c) isupper (c) |
| 406 | # define ISXDIGIT(c) (ISASCII (c) && isxdigit (c)) | 377 | # define ISXDIGIT(c) isxdigit (c) |
| 407 | 378 | ||
| 408 | # define ISWORD(c) ISALPHA(c) | 379 | # define ISWORD(c) ISALPHA(c) |
| 409 | 380 | ||
| @@ -450,10 +421,6 @@ init_syntax_once (void) | |||
| 450 | 421 | ||
| 451 | #endif /* not emacs */ | 422 | #endif /* not emacs */ |
| 452 | 423 | ||
| 453 | #ifndef NULL | ||
| 454 | # define NULL (void *)0 | ||
| 455 | #endif | ||
| 456 | |||
| 457 | /* We remove any previous definition of `SIGN_EXTEND_CHAR', | 424 | /* We remove any previous definition of `SIGN_EXTEND_CHAR', |
| 458 | since ours (we hope) works properly with all combinations of | 425 | since ours (we hope) works properly with all combinations of |
| 459 | machines, compilers, `char' and `unsigned char' argument types. | 426 | machines, compilers, `char' and `unsigned char' argument types. |