summaryrefslogtreecommitdiffstats
path: root/libc/misc/regex/regex_old.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-12-23 10:46:57 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-12-23 10:46:57 +0000
commit1e0c4ca7448cf41bd38742ae885c9da6f4e48d97 (patch)
tree3908c0720db2470fefbc4c0824401dbf45862f83 /libc/misc/regex/regex_old.c
parent7bca85d261904a0a67f2e514b6c4972128561156 (diff)
downloaduClibc-alpine-1e0c4ca7448cf41bd38742ae885c9da6f4e48d97.tar.bz2
uClibc-alpine-1e0c4ca7448cf41bd38742ae885c9da6f4e48d97.tar.xz
sync with trunk. Compile tested on i386
Diffstat (limited to 'libc/misc/regex/regex_old.c')
-rw-r--r--libc/misc/regex/regex_old.c57
1 files changed, 17 insertions, 40 deletions
diff --git a/libc/misc/regex/regex_old.c b/libc/misc/regex/regex_old.c
index 76350fc4e..65aec97f1 100644
--- a/libc/misc/regex/regex_old.c
+++ b/libc/misc/regex/regex_old.c
@@ -120,7 +120,7 @@
# endif
/* This is for other GNU distributions with internationalized messages. */
-# if HAVE_LIBINTL_H || defined _LIBC
+# if defined HAVE_LIBINTL_H || defined _LIBC
# include <libintl.h>
# ifdef _LIBC
# undef gettext
@@ -208,7 +208,7 @@ char *realloc ();
# endif /* not emacs */
-# if defined _LIBC || HAVE_LIMITS_H
+# if defined _LIBC || defined HAVE_LIMITS_H
# include <limits.h>
# endif
@@ -2091,33 +2091,12 @@ static reg_errcode_t byte_compile_range (unsigned int range_start,
# define MAX_BUF_SIZE (1L << 16)
# define REALLOC(p,s) realloc ((p), (s))
# endif
+# endif /* not DEFINED_ONCE */
/* Extend the buffer by twice its current size via realloc and
reset the pointers that pointed into the old block to point to the
correct places in the new one. If extending the buffer results in it
being larger than MAX_BUF_SIZE, then flag memory exhausted. */
-# if __BOUNDED_POINTERS__
-# define SET_HIGH_BOUND(P) (__ptrhigh (P) = __ptrlow (P) + bufp->allocated)
-# define MOVE_BUFFER_POINTER(P) \
- (__ptrlow (P) += incr, SET_HIGH_BOUND (P), __ptrvalue (P) += incr)
-# define ELSE_EXTEND_BUFFER_HIGH_BOUND \
- else \
- { \
- SET_HIGH_BOUND (b); \
- SET_HIGH_BOUND (begalt); \
- if (fixup_alt_jump) \
- SET_HIGH_BOUND (fixup_alt_jump); \
- if (laststart) \
- SET_HIGH_BOUND (laststart); \
- if (pending_exact) \
- SET_HIGH_BOUND (pending_exact); \
- }
-# else
-# define MOVE_BUFFER_POINTER(P) (P) += incr
-# define ELSE_EXTEND_BUFFER_HIGH_BOUND
-# endif
-# endif /* not DEFINED_ONCE */
-
# ifdef WCHAR
# define EXTEND_BUFFER() \
do { \
@@ -2141,16 +2120,15 @@ static reg_errcode_t byte_compile_range (unsigned int range_start,
if (old_buffer != COMPILED_BUFFER_VAR) \
{ \
int incr = COMPILED_BUFFER_VAR - old_buffer; \
- MOVE_BUFFER_POINTER (b); \
- MOVE_BUFFER_POINTER (begalt); \
+ b += incr; \
+ begalt += incr; \
if (fixup_alt_jump) \
- MOVE_BUFFER_POINTER (fixup_alt_jump); \
+ fixup_alt_jump += incr; \
if (laststart) \
- MOVE_BUFFER_POINTER (laststart); \
+ laststart += incr; \
if (pending_exact) \
- MOVE_BUFFER_POINTER (pending_exact); \
+ pending_exact += incr; \
} \
- ELSE_EXTEND_BUFFER_HIGH_BOUND \
} while (0)
# else /* BYTE */
# define EXTEND_BUFFER() \
@@ -2169,16 +2147,15 @@ static reg_errcode_t byte_compile_range (unsigned int range_start,
if (old_buffer != COMPILED_BUFFER_VAR) \
{ \
int incr = COMPILED_BUFFER_VAR - old_buffer; \
- MOVE_BUFFER_POINTER (b); \
- MOVE_BUFFER_POINTER (begalt); \
+ b += incr; \
+ begalt += incr; \
if (fixup_alt_jump) \
- MOVE_BUFFER_POINTER (fixup_alt_jump); \
+ fixup_alt_jump += incr; \
if (laststart) \
- MOVE_BUFFER_POINTER (laststart); \
+ laststart += incr; \
if (pending_exact) \
- MOVE_BUFFER_POINTER (pending_exact); \
+ pending_exact += incr; \
} \
- ELSE_EXTEND_BUFFER_HIGH_BOUND \
} while (0)
# endif /* WCHAR */
@@ -2253,7 +2230,7 @@ typedef struct
}
# ifndef DEFINED_ONCE
-# if defined _LIBC || WIDE_CHAR_SUPPORT
+# if defined _LIBC || defined WIDE_CHAR_SUPPORT
/* The GNU C library provides support for user-defined character classes
and the functions from ISO C amendement 1. */
# ifdef CHARCLASS_NAME_MAX
@@ -3309,7 +3286,7 @@ PREFIX(regex_compile) (
the leading `:' and `[' (but set bits for them). */
if (c == ':' && *p == ']')
{
-# if defined _LIBC || WIDE_CHAR_SUPPORT
+# if defined _LIBC || defined WIDE_CHAR_SUPPORT
boolean is_lower = STREQ (str, "lower");
boolean is_upper = STREQ (str, "upper");
wctype_t wt;
@@ -4565,7 +4542,7 @@ byte_compile_range (
unsigned this_char;
const char *p = *p_ptr;
reg_errcode_t ret;
-# if _LIBC
+# ifdef _LIBC
const unsigned char *collseq;
unsigned int start_colseq;
unsigned int end_colseq;
@@ -4583,7 +4560,7 @@ byte_compile_range (
/* Report an error if the range is empty and the syntax prohibits this. */
ret = syntax & RE_NO_EMPTY_RANGES ? REG_ERANGE : REG_NOERROR;
-# if _LIBC
+# ifdef _LIBC
collseq = (const unsigned char *) _NL_CURRENT (LC_COLLATE,
_NL_COLLATE_COLLSEQMB);