--- /usr/local/src/Gnu/grep/src/dfa.h 2010-03-17 21:56:16.000000000 +0200 +++ dfa.h 2010-03-18 19:24:34.000000000 +0200 @@ -350,7 +350,8 @@ -1 so we can count lines without wasting too many cycles. The transition for a newline is stored separately and handled - as a special case. */ + as a special case. Newline is also used + as a sentinel at the end of the buffer. */ struct dfamust *musts; /* List of strings, at least one of which is known to appear in any r.e. matching the dfa. */ --- /usr/local/src/Gnu/grep/src/dfa.c 2010-03-17 21:56:16.000000000 +0200 +++ dfa.c 2010-03-18 19:27:34.000000000 +0200 @@ -1,5 +1,5 @@ /* dfa.c - deterministic extended regexp routines for GNU - Copyright (C) 1988, 1998, 2000, 2002, 2004, 2008-2010 Free Software + Copyright (C) 1988, 1998, 2000, 2002, 2004, 2005, 2007-2010 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -20,16 +20,29 @@ /* Written June, 1988 by Mike Haertel Modified July, 1988 by Arthur David Olson to assist BMG speedups */ +#ifdef HAVE_CONFIG_H #include +#endif + #include #include #include + +#ifndef VMS #include +#else #include +#endif #include #include #include -#include +#if HAVE_SETLOCALE +# include +#endif +#ifndef DEBUG /* use the same approach as regex.c */ +#undef assert +#define assert(e) +#endif /* DEBUG */ #ifndef isgraph #define isgraph(C) (isprint(C) && !isspace(C)) --- /usr/local/src/Gnu/grep/lib/xalloc.h 2010-03-09 21:57:00.000000000 +0200 +++ xalloc.h 2010-03-18 23:30:01.000000000 +0200 @@ -102,6 +102,14 @@ # define XCALLOC(n, t) \ ((t *) (sizeof (t) == 1 ? xzalloc (n) : xcalloc (n, sizeof (t)))) +/* + * Gawk uses this file only to keep dfa.c happy. + * We're therefore safe in manually defining HAVE_INLINE to + * make the address@hidden&*() thing just work. + */ +#ifdef GAWK +#define HAVE_INLINE 1 /* so there. nyah, nyah, nyah. */ +#endif # if HAVE_INLINE # define static_inline static inline @@ -126,6 +134,43 @@ return xmalloc (n * s); } +#ifdef GAWK +#include +/* Allocate an array of N objects, each with S bytes of memory, + dynamically, with error checking. S must be nonzero. + Clear the contents afterwards. */ + +void * +xcalloc(size_t nmemb, size_t size) +{ + void *p = xmalloc (nmemb * size); + memset(p, '\0', nmemb * size); + return p; +} + +/* Reallocate a pointer to a new size, with error checking. */ + +void * +xrealloc(void *p, size_t size) +{ + void *new_p = realloc(p, size); + if (new_p == 0) + xalloc_die (); + + return new_p; +} + +/* xalloc_die --- fatal error message when malloc fails, needed by dfa.c */ + +void +xalloc_die (void) +{ + extern void r_fatal(const char *msg, ...) ATTRIBUTE_NORETURN ; + + r_fatal(_("xalloc: malloc failed: %s"), strerror(errno)); +} +#endif + /* Change the size of an allocated block of memory P to an array of N objects each of S bytes, with error checking. S must be nonzero. */