From: Paul Eggert Date: Fri, 27 Mar 2015 18:14:14 +0000 (-0700) Subject: Port etags to -DDEBUG X-Git-Tag: emacs-25.0.90~2564^2~57 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=84c7c6fd2b9604fa28e0b834caa46423114b9c5b;p=emacs.git Port etags to -DDEBUG * etags.c (xnew, xrnew) [DEBUG]: Don't include chkmalloc.h, which is not part of Emacs and is typically not installed. Instead, just invoke xmalloc and xrealloc as usual. Problem reported by Nicolas Richard in: http://bugs.gnu.org/20191#20 (xrnew): Avoid no-longer-needed cast to 'char *'. (xrealloc): First arg is now void *, not char *. --- diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 97868094bda..0bb24c375e7 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,14 @@ +2015-03-27 Paul Eggert + + Port etags to -DDEBUG + * etags.c (xnew, xrnew) [DEBUG]: Don't include chkmalloc.h, which + is not part of Emacs and is typically not installed. + Instead, just invoke xmalloc and xrealloc as usual. + Problem reported by Nicolas Richard in: + http://bugs.gnu.org/20191#20 + (xrnew): Avoid no-longer-needed cast to 'char *'. + (xrealloc): First arg is now void *, not char *. + 2015-03-06 Paul Eggert Random minor fixes for movemail diff --git a/lib-src/etags.c b/lib-src/etags.c index 7f1875547cf..b1361dbe7ad 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -176,17 +176,8 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; * SYNOPSIS: Type *xnew (int n, Type); * void xrnew (OldPointer, int n, Type); */ -#if DEBUG -# include "chkmalloc.h" -# define xnew(n,Type) ((Type *) trace_malloc (__FILE__, __LINE__, \ - (n) * sizeof (Type))) -# define xrnew(op,n,Type) ((op) = (Type *) trace_realloc (__FILE__, __LINE__, \ - (char *) (op), (n) * sizeof (Type))) -#else -# define xnew(n,Type) ((Type *) xmalloc ((n) * sizeof (Type))) -# define xrnew(op,n,Type) ((op) = (Type *) xrealloc ( \ - (char *) (op), (n) * sizeof (Type))) -#endif +#define xnew(n, Type) ((Type *) xmalloc ((n) * sizeof (Type))) +#define xrnew(op, n, Type) ((op) = (Type *) xrealloc (op, (n) * sizeof (Type))) typedef void Lang_function (FILE *); @@ -348,7 +339,7 @@ static void canonicalize_filename (char *); static void linebuffer_init (linebuffer *); static void linebuffer_setlen (linebuffer *, int); static void *xmalloc (size_t); -static void *xrealloc (char *, size_t); +static void *xrealloc (void *, size_t); static char searchar = '/'; /* use /.../ searches */ @@ -6533,7 +6524,7 @@ xmalloc (size_t size) } static void * -xrealloc (char *ptr, size_t size) +xrealloc (void *ptr, size_t size) { void *result = realloc (ptr, size); if (result == NULL)