summaryrefslogtreecommitdiff
path: root/libc/misc/regex/regex_internal.h
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-12-26 17:18:43 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-12-26 17:18:43 +0000
commit1c8c83e23b998a6b420b8b33a01077d16209b54f (patch)
tree2bdb55b9f93de0232b1e9c3d4a7ef675f361a682 /libc/misc/regex/regex_internal.h
parent63c18a8309ee4c333923de904a29dd7e81d2cdc7 (diff)
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
Diffstat (limited to 'libc/misc/regex/regex_internal.h')
-rw-r--r--libc/misc/regex/regex_internal.h89
1 files changed, 23 insertions, 66 deletions
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 <stdlib.h>
#include <string.h>
-#if defined HAVE_LANGINFO_H || defined HAVE_LANGINFO_CODESET || defined _LIBC
+#if defined HAVE_LANGINFO_H || defined HAVE_LANGINFO_CODESET
# include <langinfo.h>
#endif
-#if defined HAVE_LOCALE_H || defined _LIBC
+#if defined HAVE_LOCALE_H
# include <locale.h>
#endif
-#if defined HAVE_WCHAR_H || defined _LIBC
+#if defined HAVE_WCHAR_H
# include <wchar.h>
#endif
-#if defined HAVE_WCTYPE_H || defined _LIBC
+#if defined HAVE_WCTYPE_H
# include <wctype.h>
#endif
-#if defined HAVE_STDBOOL_H || defined _LIBC
+#if defined HAVE_STDBOOL_H
# include <stdbool.h>
#endif
-#if defined HAVE_STDINT_H || defined _LIBC
+#if defined HAVE_STDINT_H
# include <stdint.h>
#endif
-#if defined _LIBC
-# include <bits/libc-lock.h>
-#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 <locale/localeinfo.h>
-# include <locale/elem-hash.h>
-# include <locale/coll-lookup.h>
-# endif
-#endif
-
-/* This is for other GNU distributions with internationalized messages. */
-#if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
-# include <libintl.h>
-# 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 <alloca.h>
-#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 */