[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[patches] Regexp engine option group>
- To: patches@xxxxxxxxxx
- Subject: [patches] Regexp engine option group>
- From: Jim Blandy <jimb@xxxxxxxxxxxxxxxx>
- Date: Wed, 13 Jun 2007 17:18:21 -0700
I've committed the following. The regexp matcher is about 5% of the
memory size of EGLIBC, and it was easy to make optional.
ChangeLog.eglibc:
2007-06-13 Jim Blandy <jimb@xxxxxxxxxxxxxxxx>
Add the OPTION_POSIX_REGEXP option group.
* option-groups.def (OPTION_POSIX_REGEXP): New entry.
* option-groups.defaults (OPTION_POSIX_REGEXP): Initialize.
* posix/Makefile: Include ../option-groups.mak.
(routines): Move 'regex' into the group.
* stdlib/Makefile: Put rpmatch in both the OPTION_POSIX_REGEXP and
OPTION_EGLIBC_LOCALE_CODE groups.
* misc/Makefile: Put regexp in the group.
* locale/Makefile (CFLAGS-ld-messages.c): Define
OPTION_POSIX_REGEXP as appropriate.
* locale/programs/ld-messages.c: Don't check the syntax of 'yes'
and 'no' regular expressions if the group isn't enabled.
Index: stdlib/Makefile
===================================================================
--- stdlib/Makefile (revision 2504)
+++ stdlib/Makefile (working copy)
@@ -55,7 +55,10 @@
strtoimax strtoumax wcstoimax wcstoumax \
getcontext setcontext makecontext swapcontext
routines-$(OPTION_EGLIBC_LOCALE_CODE) += \
- rpmatch strfmon strfmon_l
+ strfmon strfmon_l
+ifeq (yy,$(OPTION_EGLIBC_LOCALE_CODE)$(OPTION_POSIX_REGEXP))
+routines-y += rpmatch
+endif
aux = grouping groupingwc
# These routines will be omitted from the libc shared object.
Index: misc/Makefile
===================================================================
--- misc/Makefile (revision 2504)
+++ misc/Makefile (working copy)
@@ -63,12 +63,14 @@
efgcvt efgcvt_r qefgcvt qefgcvt_r \
hsearch hsearch_r tsearch lsearch \
err error ustat \
- getsysstats dirname regexp \
+ getsysstats dirname \
getloadavg getclktck \
fgetxattr flistxattr fremovexattr fsetxattr getxattr \
listxattr lgetxattr llistxattr lremovexattr lsetxattr \
removexattr setxattr
+routines-$(OPTION_POSIX_REGEXP) += regexp
+
distribute := device-nrs.h
generated := tst-error1.mtrace tst-error1-mem
Index: locale/Makefile
===================================================================
--- locale/Makefile (revision 2504)
+++ locale/Makefile (working copy)
@@ -116,11 +116,14 @@
OPTION_EGLIBC_LOCALE_CODE-CFLAGS-$(OPTION_EGLIBC_LOCALE_CODE) \
= -DOPTION_EGLIBC_LOCALE_CODE
+OPTION_POSIX_REGEXP-CFLAGS-$(OPTION_POSIX_REGEXP) \
+ = -DOPTION_POSIX_REGEXP
CFLAGS-xlocale.c = $(OPTION_EGLIBC_LOCALE_CODE-CFLAGS-y)
CFLAGS-charmap.c = -Wno-write-strings -Wno-char-subscripts
CFLAGS-locfile.c = -Wno-write-strings -Wno-char-subscripts
CFLAGS-charmap-dir.c = -Wno-write-strings
+CFLAGS-ld-messages.c = $(OPTION_POSIX_REGEXP-CFLAGS-y)
# This makes sure -DNOT_IN_libc is passed for all these modules.
cpp-srcs-left := $(addsuffix .c,$(localedef-modules) $(localedef-aux) \
Index: locale/programs/ld-messages.c
===================================================================
--- locale/programs/ld-messages.c (revision 2504)
+++ locale/programs/ld-messages.c (working copy)
@@ -123,6 +123,7 @@
}
else
{
+#ifdef OPTION_POSIX_REGEXP
int result;
regex_t re;
@@ -139,6 +140,7 @@
}
else if (result != 0)
regfree (&re);
+#endif
}
if (messages->noexpr == NULL)
@@ -157,6 +159,7 @@
}
else
{
+#ifdef OPTION_POSIX_REGEXP
int result;
regex_t re;
@@ -173,6 +176,7 @@
}
else if (result != 0)
regfree (&re);
+#endif
}
}
Index: option-groups.defaults
===================================================================
--- option-groups.defaults (revision 2504)
+++ option-groups.defaults (working copy)
@@ -14,3 +14,4 @@
OPTION_EGLIBC_LIBM = y
OPTION_EGLIBC_LOCALES = y
OPTION_EGLIBC_LOCALE_CODE = y
+OPTION_POSIX_REGEXP = y
Index: option-groups.def
===================================================================
--- option-groups.def (revision 2504)
+++ option-groups.def (working copy)
@@ -288,3 +288,23 @@
group; if you disable OPTION_EGLIBC_LOCALE_CODE, you must also
disable OPTION_EGLIBC_CATGETS.
+config OPTION_POSIX_REGEXP
+ bool "Regular expressions"
+ help
+ This option group includes the POSIX regular expression
+ functions, and the associated non-POSIX extensions and
+ compatibility functions.
+
+ With OPTION_POSIX_REGEXP disabled, the following functions are
+ omitted from libc:
+
+ re_comp re_max_failures regcomp
+ re_compile_fastmap re_search regerror
+ re_compile_pattern re_search_2 regexec
+ re_exec re_set_registers regfree
+ re_match re_set_syntax rpmatch
+ re_match_2 re_syntax_options
+
+ Furthermore, the compatibility regexp interface defined in the
+ <regexp.h> header file, 'compile', 'step', and 'advance', is
+ omitted.
Index: posix/Makefile
===================================================================
--- posix/Makefile (revision 2504)
+++ posix/Makefile (working copy)
@@ -52,7 +52,7 @@
getresuid getresgid setresuid setresgid \
getlogin getlogin_r setlogin \
pathconf sysconf fpathconf \
- glob glob64 fnmatch regex \
+ glob glob64 fnmatch \
confstr \
getopt getopt1 getopt_init \
sched_setp sched_getp sched_sets sched_gets sched_yield sched_primax \
@@ -71,6 +71,7 @@
get_child_max sched_cpucount
routines-$(OPTION_EGLIBC_INET) += getaddrinfo gai_strerror
+routines-$(OPTION_POSIX_REGEXP) += regex
include ../Makeconfig