From 672fd41bbcc594603afb7ce444ae2ffd23dc0bdc Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 7 Feb 2001 01:28:35 +0000 Subject: Update. 2001-02-06 Ulrich Drepper * sysdeps/unix/sysv/linux/ia64/pt-initfini.c: First attempt to fix the broken code. Patch by Jes Sorensen. --- posix/regex.c | 80 +++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 51 insertions(+), 29 deletions(-) (limited to 'posix/regex.c') diff --git a/posix/regex.c b/posix/regex.c index b4979d0..a6e6507 100644 --- a/posix/regex.c +++ b/posix/regex.c @@ -62,7 +62,13 @@ # define US_CHAR_TYPE wchar_t/* unsigned character type */ # define COMPILED_BUFFER_VAR wc_buffer # define OFFSET_ADDRESS_SIZE 1 /* the size which STORE_NUMBER macro use */ -# define PUT_CHAR(c) printf ("%C", c) /* Should we use wide stream?? */ +# define PUT_CHAR(c) \ + do { \ + if (MC_CUR_MAX == 1) \ + putchar (c); \ + else \ + printf ("%C", (wint_t) c); /* Should we use wide stream?? */ \ + } while (0) # define TRUE 1 # define FALSE 0 #else @@ -754,7 +760,7 @@ print_partial_compiled_pattern (start, end) while (p < pend) { #ifdef _LIBC - printf ("%t:\t", p - start); + printf ("%td:\t", p - start); #else printf ("%ld:\t", (long int) (p - start)); #endif @@ -782,7 +788,7 @@ print_partial_compiled_pattern (start, end) printf ("/exactn_bin/%d", mcnt); do { - printf("/%x", *p++); + printf("/%lx", (long int) *p++); } while (--mcnt); break; @@ -790,16 +796,16 @@ print_partial_compiled_pattern (start, end) case start_memory: mcnt = *p++; - printf ("/start_memory/%d/%d", mcnt, *p++); + printf ("/start_memory/%d/%ld", mcnt, (long int) *p++); break; case stop_memory: mcnt = *p++; - printf ("/stop_memory/%d/%d", mcnt, *p++); + printf ("/stop_memory/%d/%ld", mcnt, (long int) *p++); break; case duplicate: - printf ("/duplicate/%d", *p++); + printf ("/duplicate/%ld", (long int) *p++); break; case anychar: @@ -817,7 +823,7 @@ print_partial_compiled_pattern (start, end) p += 5; length = *workp++; /* the length of char_classes */ for (i=0 ; i bufp->allocated) \ EXTEND_BUFFER () #else @@ -1922,7 +1934,7 @@ static reg_errcode_t compile_range _RE_ARGS ((unsigned int range_start, #define BUF_PUSH(c) \ do { \ GET_BUFFER_SPACE (1); \ - *b++ = (US_CHAR_TYPE) (c); \ + *b++ = (US_CHAR_TYPE) (c); \ } while (0) @@ -4153,7 +4165,7 @@ regex_compile (pattern, size, syntax, bufp) /* We have succeeded; set the length of the buffer. */ #ifdef MBS_SUPPORT - bufp->used = (int) b - (int) COMPILED_BUFFER_VAR; + bufp->used = (uintptr_t) b - (uintptr_t) COMPILED_BUFFER_VAR; #else bufp->used = b - bufp->buffer; #endif @@ -5936,7 +5948,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) goto fail; SET_REGS_MATCHED (); - DEBUG_PRINT2 (" Matched `%d'.\n", *d); + DEBUG_PRINT2 (" Matched `%ld'.\n", (long int) *d); d++; break; @@ -6308,7 +6320,8 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) matched within the group is recorded (in the internal registers data structure) under the register number. */ case start_memory: - DEBUG_PRINT3 ("EXECUTING start_memory %d (%d):\n", *p, p[1]); + DEBUG_PRINT3 ("EXECUTING start_memory %ld (%ld):\n", + (long int) *p, (long int) p[1]); /* Find out if this group can match the empty string. */ p1 = p; /* To send to group_match_null_string_p. */ @@ -6356,7 +6369,8 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) arguments are the same as start_memory's: the register number, and the number of inner groups. */ case stop_memory: - DEBUG_PRINT3 ("EXECUTING stop_memory %d (%d):\n", *p, p[1]); + DEBUG_PRINT3 ("EXECUTING stop_memory %ld (%ld):\n", + (long int) *p, (long int) p[1]); /* We need to save the string position the last time we were at this close-group operator in case the group is operated @@ -6766,8 +6780,16 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) { p[-(1+OFFSET_ADDRESS_SIZE)] = (US_CHAR_TYPE) pop_failure_jump; - DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n", - c, p1[3+OFFSET_ADDRESS_SIZE]); +#ifdef MBS_SUPPORT + if (MB_CUR_MAX != 1) + DEBUG_PRINT3 (" %C != %C => pop_failure_jump.\n", + (wint_t) c, + (wint_t) p1[3+OFFSET_ADDRESS_SIZE]); + else +#endif + DEBUG_PRINT3 (" %c != %c => pop_failure_jump.\n", + (char) c, + (char) p1[3+OFFSET_ADDRESS_SIZE]); } #ifndef MBS_SUPPORT @@ -6776,7 +6798,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) { int not = (re_opcode_t) p1[3] == charset_not; - if (c < (unsigned char) (p1[4] * BYTEWIDTH) + if (c < (unsigned) (p1[4] * BYTEWIDTH) && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) not = !not; -- cgit v1.1