From: Bruno Haible Date: Mon, 24 May 2010 10:40:00 +0000 (+0200) Subject: Use regex module without dependency on 'malloc'. X-Git-Tag: v0.18.1~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6790213abfb628056d52cd77f6a2d67823952646;p=thirdparty%2Fgettext.git Use regex module without dependency on 'malloc'. --- diff --git a/gnulib-local/ChangeLog b/gnulib-local/ChangeLog index 82f74567f..919f2ce53 100644 --- a/gnulib-local/ChangeLog +++ b/gnulib-local/ChangeLog @@ -1,3 +1,11 @@ +2010-05-24 Bruno Haible + + Use regex module without dependency on 'malloc'. + * lib/regex_internal.h.diff: New file. + * lib/regexec.c.diff: New file. + * modules/regex.diff: New file. + * Makefile.am (EXTRA_DIST): Add them. + 2010-05-23 Bruno Haible Do regex matching purely with regex, not regex + dfa + kwset. diff --git a/gnulib-local/Makefile.am b/gnulib-local/Makefile.am index a46d7b3db..f924ad3aa 100644 --- a/gnulib-local/Makefile.am +++ b/gnulib-local/Makefile.am @@ -222,6 +222,8 @@ lib/obstack.h.diff \ lib/ostream.oo.c \ lib/ostream.oo.h \ lib/progname.h.diff \ +lib/regexec.c.diff \ +lib/regex_internal.h.diff \ lib/styled-ostream.oo.c \ lib/styled-ostream.oo.h \ lib/term-ostream.oo.c \ @@ -282,6 +284,7 @@ modules/moo-tests \ modules/ostream \ modules/quotearg.diff \ modules/quote.diff \ +modules/regex.diff \ modules/styled-ostream \ modules/termcap \ modules/termcap-h \ diff --git a/gnulib-local/lib/regex_internal.h.diff b/gnulib-local/lib/regex_internal.h.diff new file mode 100644 index 000000000..bfcc24200 --- /dev/null +++ b/gnulib-local/lib/regex_internal.h.diff @@ -0,0 +1,19 @@ +*** lib/regex_internal.h.orig Mon May 24 12:36:55 2010 +--- lib/regex_internal.h Mon May 24 12:35:46 2010 +*************** +*** 476,482 **** + # define MAX(a,b) ((a) < (b) ? (b) : (a)) + #endif + +! #define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t))) + #define re_realloc(p,t,n) ((t *) realloc (p, (n) * sizeof (t))) + #define re_free(p) free (p) + +--- 476,482 ---- + # define MAX(a,b) ((a) < (b) ? (b) : (a)) + #endif + +! #define re_malloc(t,n) ((t *) malloc ((n) > 0 ? (n) * sizeof (t) : 1)) + #define re_realloc(p,t,n) ((t *) realloc (p, (n) * sizeof (t))) + #define re_free(p) free (p) + diff --git a/gnulib-local/lib/regexec.c.diff b/gnulib-local/lib/regexec.c.diff new file mode 100644 index 000000000..eede89671 --- /dev/null +++ b/gnulib-local/lib/regexec.c.diff @@ -0,0 +1,19 @@ +*** lib/regexec.c.orig Mon May 24 12:36:55 2010 +--- lib/regexec.c Mon May 24 12:34:41 2010 +*************** +*** 3425,3431 **** + else + { + dest_states = (re_dfastate_t **) +! malloc (ndests * 3 * sizeof (re_dfastate_t *)); + if (BE (dest_states == NULL, 0)) + { + out_free: +--- 3425,3431 ---- + else + { + dest_states = (re_dfastate_t **) +! re_malloc (re_dfastate_t *, ndests * 3); + if (BE (dest_states == NULL, 0)) + { + out_free: diff --git a/gnulib-local/modules/regex.diff b/gnulib-local/modules/regex.diff new file mode 100644 index 000000000..ccba54910 --- /dev/null +++ b/gnulib-local/modules/regex.diff @@ -0,0 +1,19 @@ +*** modules/regex.orig Mon May 24 12:36:55 2010 +--- modules/regex Mon May 24 12:36:42 2010 +*************** +*** 17,23 **** + extensions + gettext-h + localcharset +! malloc + memcmp + memmove + mbrtowc +--- 17,23 ---- + extensions + gettext-h + localcharset +! malloc-posix + memcmp + memmove + mbrtowc