From 1c8c83e23b998a6b420b8b33a01077d16209b54f Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Fri, 26 Dec 2008 17:18:43 +0000 Subject: new regex: stop confusing ourself with _LIBC being undefined; nuke one struct initializer which was invisibly becoming a memset - this improves speed by x2: test 0 pattern 0 '.?.?.?.?.?.?.?Log\.13' - 0.249795s + 0.133522s test 0 pattern 1 '(.?)(.?)(.?)(.?)(.?)(.?)(.?)Log\.13' - 0.360115s + 0.191959s text data bss dec hex filename - 515009 2731 15396 533136 82290 lib/libuClibc-0.9.30-svn.so + 514961 2727 15396 533084 8225c lib/libuClibc-0.9.30-svn.so --- libc/misc/regex/regex_internal.h | 89 +++++++++++----------------------------- 1 file changed, 23 insertions(+), 66 deletions(-) (limited to 'libc/misc/regex/regex_internal.h') diff --git a/libc/misc/regex/regex_internal.h b/libc/misc/regex/regex_internal.h index 7b95d2e38..85efe6655 100644 --- a/libc/misc/regex/regex_internal.h +++ b/libc/misc/regex/regex_internal.h @@ -27,66 +27,36 @@ #include #include -#if defined HAVE_LANGINFO_H || defined HAVE_LANGINFO_CODESET || defined _LIBC +#if defined HAVE_LANGINFO_H || defined HAVE_LANGINFO_CODESET # include #endif -#if defined HAVE_LOCALE_H || defined _LIBC +#if defined HAVE_LOCALE_H # include #endif -#if defined HAVE_WCHAR_H || defined _LIBC +#if defined HAVE_WCHAR_H # include #endif -#if defined HAVE_WCTYPE_H || defined _LIBC +#if defined HAVE_WCTYPE_H # include #endif -#if defined HAVE_STDBOOL_H || defined _LIBC +#if defined HAVE_STDBOOL_H # include #endif -#if defined HAVE_STDINT_H || defined _LIBC +#if defined HAVE_STDINT_H # include #endif -#if defined _LIBC -# include -#else -# define __libc_lock_define(CLASS,NAME) -# define __libc_lock_init(NAME) do { } while (0) -# define __libc_lock_lock(NAME) do { } while (0) -# define __libc_lock_unlock(NAME) do { } while (0) -#endif -/* In case that the system doesn't have isblank(). */ -#if !defined _LIBC && !defined HAVE_ISBLANK && !defined isblank && !defined __UCLIBC__ -# define isblank(ch) ((ch) == ' ' || (ch) == '\t') -#endif +#define __libc_lock_define(CLASS, NAME) +#define __libc_lock_init(NAME) do { } while (0) +#define __libc_lock_lock(NAME) do { } while (0) +#define __libc_lock_unlock(NAME) do { } while (0) -#if defined _LIBC && !defined __UCLIBC__ -# ifndef _RE_DEFINE_LOCALE_FUNCTIONS -# define _RE_DEFINE_LOCALE_FUNCTIONS 1 -# include -# include -# include -# endif -#endif - -/* This is for other GNU distributions with internationalized messages. */ -#if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC -# include -# ifdef _LIBC -# undef gettext -# define gettext(msgid) \ - INTUSE(__dcgettext) (_libc_intl_domainname, msgid, LC_MESSAGES) -# endif -#else -# define gettext(msgid) (msgid) -#endif +#undef gettext +#undef gettext_noop +#define gettext(msgid) (msgid) +#define gettext_noop(String) String -#ifndef gettext_noop -/* This define is so xgettext can find the internationalizable - strings. */ -# define gettext_noop(String) String -#endif - -#if (defined MB_CUR_MAX && HAVE_LOCALE_H && HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_WCRTOMB && HAVE_MBRTOWC && HAVE_WCSCOLL) || _LIBC +#if (defined MB_CUR_MAX && HAVE_LOCALE_H && HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_WCRTOMB && HAVE_MBRTOWC && HAVE_WCSCOLL) # define RE_ENABLE_I18N #endif @@ -108,15 +78,6 @@ #define NEWLINE_CHAR '\n' #define WIDE_NEWLINE_CHAR L'\n' -/* Rename to standard API for using out of glibc. */ -#if !defined _LIBC && !defined __UCLIBC__ -# define __wctype wctype -# define __iswctype iswctype -# define __btowc btowc -# define __wcrtomb wcrtomb -# define attribute_hidden -#endif /* not _LIBC */ - #ifdef __GNUC__ # define __attribute(arg) __attribute__ (arg) #else @@ -236,23 +197,23 @@ typedef struct wchar_t *mbchars; /* Collating symbols. */ -# ifdef _LIBC +# if 0 int32_t *coll_syms; # endif /* Equivalence classes. */ -# ifdef _LIBC +# if 0 int32_t *equiv_classes; # endif /* Range expressions. */ -# ifdef _LIBC +# if 0 uint32_t *range_starts; uint32_t *range_ends; -# else /* not _LIBC */ +# else wchar_t *range_starts; wchar_t *range_ends; -# endif /* not _LIBC */ +# endif /* Character classes. */ wctype_t *char_classes; @@ -399,7 +360,7 @@ static unsigned int re_string_context_at (const re_string_t *input, int idx, #include -#ifndef _LIBC +#if 1 # if HAVE_ALLOCA /* The OS usually guarantees only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely @@ -544,11 +505,7 @@ typedef struct { /* The string object corresponding to the input string. */ re_string_t input; -#if defined _LIBC || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) - const re_dfa_t *const dfa; -#else const re_dfa_t *dfa; -#endif /* EFLAGS of the argument of regexec. */ int eflags; /* Where the matching ends. */ @@ -721,7 +678,7 @@ static int internal_function __attribute ((pure)) re_string_elem_size_at (const re_string_t *pstr, int idx) { -# ifdef _LIBC +# if 0 const unsigned char *p, *extra; const int32_t *table, *indirect; int32_t tmp; @@ -739,7 +696,7 @@ re_string_elem_size_at (const re_string_t *pstr, int idx) tmp = findidx (&p); return p - pstr->mbs - idx; } -# endif /* _LIBC */ +# endif return 1; } #endif /* RE_ENABLE_I18N */ -- cgit v1.2.3