summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2015-03-27 11:14:14 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2015-03-27 11:14:33 -0700
commit84c7c6fd2b9604fa28e0b834caa46423114b9c5b (patch)
tree12ff656dbc54a7840693cef1d0432f85ba51f8c4
parent087fdee723da5968679d0392302043f10a5934bb (diff)
downloademacs-84c7c6fd2b9604fa28e0b834caa46423114b9c5b.tar.gz
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 *.
-rw-r--r--lib-src/ChangeLog11
-rw-r--r--lib-src/etags.c17
2 files changed, 15 insertions, 13 deletions
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 <eggert@cs.ucla.edu>
+
+ 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 <eggert@cs.ucla.edu>
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)