diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2005-03-21 07:42:07 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2005-03-21 07:42:07 +0000 |
commit | e0f53f4ecc763f384115cd5affb8162db14b488e (patch) | |
tree | 892485dd8d205061416a6ca9a43fd1175566b378 /lib | |
parent | 3f6b9f946e288e850f012ed4dda88342402d97a1 (diff) | |
download | coreutils-e0f53f4ecc763f384115cd5affb8162db14b488e.tar.xz |
Sync from gnulib.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ChangeLog | 6 | ||||
-rw-r--r-- | lib/gettext.h | 2 | ||||
-rw-r--r-- | lib/regex.c | 55 | ||||
-rw-r--r-- | lib/setenv.c | 2 | ||||
-rw-r--r-- | lib/vasnprintf.c | 5 | ||||
-rw-r--r-- | lib/vasprintf.c | 2 |
6 files changed, 44 insertions, 28 deletions
diff --git a/lib/ChangeLog b/lib/ChangeLog index 4d2260dab..cb0a2187b 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,9 @@ +2005-03-20 Paul Eggert <eggert@cs.ucla.edu> + + * gettext.h, regex.c, setenv.c, vasprintf.c: Sync from gnulib. + * vasnprintf.c (EOVERFLOW): Define if not already defined. + This merges a change from gnulib. + 2005-03-18 Paul Eggert <eggert@cs.ucla.edu> * strftime.c (my_strftime): If the underlying strftime returns 0 diff --git a/lib/gettext.h b/lib/gettext.h index a0606dde5..67b12f83a 100644 --- a/lib/gettext.h +++ b/lib/gettext.h @@ -1,5 +1,5 @@ /* Convenience header for conditional use of GNU <libintl.h>. - Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc. + Copyright (C) 1995-1998, 2000-2002, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/lib/regex.c b/lib/regex.c index d3840704a..51106c051 100644 --- a/lib/regex.c +++ b/lib/regex.c @@ -4,7 +4,7 @@ internationalization features.) Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003, 2004 Free Software Foundation, Inc. + 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -2079,7 +2079,8 @@ static reg_errcode_t byte_compile_range (unsigned int range_start, bufp->allocated <<= 1; \ if (bufp->allocated > MAX_BUF_SIZE) \ bufp->allocated = MAX_BUF_SIZE; \ - bufp->buffer = REALLOC (COMPILED_BUFFER_VAR, bufp->allocated); \ + bufp->buffer \ + = (UCHAR_T *) REALLOC (COMPILED_BUFFER_VAR, bufp->allocated); \ if (COMPILED_BUFFER_VAR == NULL) \ return REG_ESPACE; \ /* If the buffer moved, move all the pointers into it. */ \ @@ -6010,19 +6011,22 @@ byte_re_match_2_internal (struct re_pattern_buffer *bufp, longest match, try backtracking. */ if (d != end_match_2) { - /* 1 if this match ends in the same string (string1 or string2) - as the best previous match. */ - boolean same_str_p = (FIRST_STRING_P (match_end) - == MATCHING_IN_FIRST_STRING); /* 1 if this match is the best seen so far. */ boolean best_match_p; - /* AIX compiler got confused when this was combined - with the previous declaration. */ - if (same_str_p) - best_match_p = d > match_end; - else - best_match_p = !MATCHING_IN_FIRST_STRING; + { + /* 1 if this match ends in the same string (string1 or string2) + as the best previous match. */ + boolean same_str_p = (FIRST_STRING_P (match_end) + == MATCHING_IN_FIRST_STRING); + + /* AIX compiler got confused when this was combined + with the previous declaration. */ + if (same_str_p) + best_match_p = d > match_end; + else + best_match_p = !MATCHING_IN_FIRST_STRING; + } DEBUG_PRINT1 ("backtracking.\n"); @@ -6277,9 +6281,9 @@ byte_re_match_2_internal (struct re_pattern_buffer *bufp, uint32_t nrules; # endif /* _LIBC */ #endif /* WCHAR */ - boolean not = (re_opcode_t) *(p - 1) == charset_not; + boolean negate = (re_opcode_t) *(p - 1) == charset_not; - DEBUG_PRINT2 ("EXECUTING charset%s.\n", not ? "_not" : ""); + DEBUG_PRINT2 ("EXECUTING charset%s.\n", negate ? "_not" : ""); PREFETCH (); c = TRANSLATE (*d); /* The character to match. */ #ifdef WCHAR @@ -6612,20 +6616,20 @@ byte_re_match_2_internal (struct re_pattern_buffer *bufp, if (c == *workp) goto char_set_matched; - not = !not; + negate = !negate; char_set_matched: - if (not) goto fail; + if (negate) goto fail; #else /* Cast to `unsigned' instead of `unsigned char' in case the bit list is a full 32 bytes long. */ if (c < (unsigned) (*p * BYTEWIDTH) && p[1 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) - not = !not; + negate = !negate; p += 1 + *p; - if (!not) goto fail; + if (!negate) goto fail; #undef WORK_BUFFER_SIZE #endif /* WCHAR */ SET_REGS_MATCHED (); @@ -7125,15 +7129,15 @@ byte_re_match_2_internal (struct re_pattern_buffer *bufp, else if ((re_opcode_t) p1[3] == charset || (re_opcode_t) p1[3] == charset_not) { - int not = (re_opcode_t) p1[3] == charset_not; + int negate = (re_opcode_t) p1[3] == charset_not; if (c < (unsigned) (p1[4] * BYTEWIDTH) && p1[5 + c / BYTEWIDTH] & (1 << (c % BYTEWIDTH))) - not = !not; + negate = !negate; - /* `not' is equal to 1 if c would match, which means + /* `negate' is equal to 1 if c would match, which means that we can't change to pop_failure_jump. */ - if (!not) + if (!negate) { p[-3] = (unsigned char) pop_failure_jump; DEBUG_PRINT1 (" No match => pop_failure_jump.\n"); @@ -8014,14 +8018,15 @@ regcomp (regex_t *preg, const char *pattern, int cflags) preg->used = 0; /* Try to allocate space for the fastmap. */ - preg->fastmap = malloc (1 << BYTEWIDTH); + preg->fastmap = (char *) malloc (1 << BYTEWIDTH); if (cflags & REG_ICASE) { unsigned i; - preg->translate = malloc (CHAR_SET_SIZE - * sizeof (*(RE_TRANSLATE_TYPE)0)); + preg->translate = + (RE_TRANSLATE_TYPE) + malloc (CHAR_SET_SIZE * sizeof (*(RE_TRANSLATE_TYPE)0)); if (preg->translate == NULL) return (int) REG_ESPACE; diff --git a/lib/setenv.c b/lib/setenv.c index 320469b86..ae4174af2 100644 --- a/lib/setenv.c +++ b/lib/setenv.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992,1995-1999,2000-2004 Free Software Foundation, Inc. +/* Copyright (C) 1992,1995-1999,2000-2003 Free Software Foundation, Inc. This file is part of the GNU C Library. This program is free software; you can redistribute it and/or modify diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c index a21134016..df939984a 100644 --- a/lib/vasnprintf.c +++ b/lib/vasnprintf.c @@ -52,6 +52,11 @@ # define SIZE_MAX ((size_t) -1) #endif +/* Some systems, like OSF/1 4.0 and Woe32, don't have EOVERFLOW. */ +#ifndef EOVERFLOW +# define EOVERFLOW E2BIG +#endif + #ifdef HAVE_WCHAR_T # ifdef HAVE_WCSLEN # define local_wcslen wcslen diff --git a/lib/vasprintf.c b/lib/vasprintf.c index ba94c64ba..600e8aa3f 100644 --- a/lib/vasprintf.c +++ b/lib/vasprintf.c @@ -1,5 +1,5 @@ /* Formatted output to strings. - Copyright (C) 1999, 2002-2004 Free Software Foundation, Inc. + Copyright (C) 1999, 2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by |