Imported Upstream version 1.4.12

This commit is contained in:
Jan Wagner 2013-11-26 23:55:28 +01:00
parent 1d1585cd09
commit 4ab9f0d24c
291 changed files with 27277 additions and 11364 deletions

View file

@ -1,11 +1,11 @@
/* Extended regular expression matching and search library.
Copyright (C) 2002,2003,2004,2005,2006 Free Software Foundation, Inc.
Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
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
the Free Software Foundation; either version 2, or (at your option)
the Free Software Foundation; either version 3, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
@ -451,8 +451,8 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
int
regcomp (preg, pattern, cflags)
regex_t *__restrict preg;
const char *__restrict pattern;
regex_t *_Restrict_ preg;
const char *_Restrict_ pattern;
int cflags;
{
reg_errcode_t ret;
@ -515,13 +515,13 @@ weak_alias (__regcomp, regcomp)
size_t
regerror (errcode, preg, errbuf, errbuf_size)
int errcode;
const regex_t *__restrict preg;
char *__restrict errbuf;
const regex_t *_Restrict_ preg;
char *_Restrict_ errbuf;
size_t errbuf_size;
#else /* size_t might promote */
size_t
regerror (int errcode, const regex_t *__restrict preg,
char *__restrict errbuf, size_t errbuf_size)
regerror (int errcode, const regex_t *_Restrict_ preg,
char *_Restrict_ errbuf, size_t errbuf_size)
#endif
{
const char *msg;
@ -542,17 +542,13 @@ regerror (int errcode, const regex_t *__restrict preg,
if (BE (errbuf_size != 0, 1))
{
size_t cpy_size = msg_size;
if (BE (msg_size > errbuf_size, 0))
{
#if defined HAVE_MEMPCPY || defined _LIBC
*((char *) __mempcpy (errbuf, msg, errbuf_size - 1)) = '\0';
#else
memcpy (errbuf, msg, errbuf_size - 1);
errbuf[errbuf_size - 1] = 0;
#endif
cpy_size = errbuf_size - 1;
errbuf[cpy_size] = '\0';
}
else
memcpy (errbuf, msg, msg_size);
memcpy (errbuf, msg, cpy_size);
}
return msg_size;
@ -833,9 +829,6 @@ static reg_errcode_t
init_dfa (re_dfa_t *dfa, size_t pat_len)
{
__re_size_t table_size;
#ifndef _LIBC
char *codeset_name;
#endif
#ifdef RE_ENABLE_I18N
size_t max_i18n_object_size = MAX (sizeof (wchar_t), sizeof (wctype_t));
#else
@ -879,22 +872,7 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
dfa->map_notascii = (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_TO_NONASCII)
!= 0);
#else
# ifdef HAVE_LANGINFO_CODESET
codeset_name = nl_langinfo (CODESET);
# else
codeset_name = getenv ("LC_ALL");
if (codeset_name == NULL || codeset_name[0] == '\0')
codeset_name = getenv ("LC_CTYPE");
if (codeset_name == NULL || codeset_name[0] == '\0')
codeset_name = getenv ("LANG");
if (codeset_name == NULL)
codeset_name = "";
else if (strchr (codeset_name, '.') != NULL)
codeset_name = strchr (codeset_name, '.') + 1;
# endif
if (strcasecmp (codeset_name, "UTF-8") == 0
|| strcasecmp (codeset_name, "UTF8") == 0)
if (strcmp (locale_charset (), "UTF-8") == 0)
dfa->is_utf8 = 1;
/* We check exhaustively in the loop below if this charset is a
@ -1071,7 +1049,7 @@ optimize_utf8 (re_dfa_t *dfa)
mb_chars = true;
break;
case ANCHOR:
switch (dfa->nodes[node].opr.idx)
switch (dfa->nodes[node].opr.ctx_type)
{
case LINE_FIRST:
case LINE_LAST:
@ -3074,7 +3052,7 @@ parse_bracket_exp (re_string_t *regexp, re_dfa_t *dfa, re_token_t *token,
#endif /* not RE_ENABLE_I18N */
non_match = true;
if (syntax & RE_HAT_LISTS_NOT_NEWLINE)
bitset_set (sbcset, '\0');
bitset_set (sbcset, '\n');
re_string_skip_bytes (regexp, token_len); /* Skip a token. */
token_len = peek_token_bracket (token, regexp, syntax);
if (BE (token->type == END_OF_RE, 0))
@ -3605,10 +3583,6 @@ build_charclass_op (re_dfa_t *dfa, RE_TRANSLATE_TYPE trans,
if (non_match)
{
#ifdef RE_ENABLE_I18N
/*
if (syntax & RE_HAT_LISTS_NOT_NEWLINE)
bitset_set(cset->sbcset, '\0');
*/
mbcset->non_match = 1;
#endif /* not RE_ENABLE_I18N */
}