aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorPaul Eggert2015-03-27 11:14:14 -0700
committerPaul Eggert2015-03-27 11:14:33 -0700
commit84c7c6fd2b9604fa28e0b834caa46423114b9c5b (patch)
tree12ff656dbc54a7840693cef1d0432f85ba51f8c4 /lib-src
parent087fdee723da5968679d0392302043f10a5934bb (diff)
downloademacs-84c7c6fd2b9604fa28e0b834caa46423114b9c5b.tar.gz
emacs-84c7c6fd2b9604fa28e0b834caa46423114b9c5b.zip
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 *.
Diffstat (limited to 'lib-src')
-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 @@
12015-03-27 Paul Eggert <eggert@cs.ucla.edu>
2
3 Port etags to -DDEBUG
4 * etags.c (xnew, xrnew) [DEBUG]: Don't include chkmalloc.h, which
5 is not part of Emacs and is typically not installed.
6 Instead, just invoke xmalloc and xrealloc as usual.
7 Problem reported by Nicolas Richard in:
8 http://bugs.gnu.org/20191#20
9 (xrnew): Avoid no-longer-needed cast to 'char *'.
10 (xrealloc): First arg is now void *, not char *.
11
12015-03-06 Paul Eggert <eggert@cs.ucla.edu> 122015-03-06 Paul Eggert <eggert@cs.ucla.edu>
2 13
3 Random minor fixes for movemail 14 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";
176 * SYNOPSIS: Type *xnew (int n, Type); 176 * SYNOPSIS: Type *xnew (int n, Type);
177 * void xrnew (OldPointer, int n, Type); 177 * void xrnew (OldPointer, int n, Type);
178 */ 178 */
179#if DEBUG 179#define xnew(n, Type) ((Type *) xmalloc ((n) * sizeof (Type)))
180# include "chkmalloc.h" 180#define xrnew(op, n, Type) ((op) = (Type *) xrealloc (op, (n) * sizeof (Type)))
181# define xnew(n,Type) ((Type *) trace_malloc (__FILE__, __LINE__, \
182 (n) * sizeof (Type)))
183# define xrnew(op,n,Type) ((op) = (Type *) trace_realloc (__FILE__, __LINE__, \
184 (char *) (op), (n) * sizeof (Type)))
185#else
186# define xnew(n,Type) ((Type *) xmalloc ((n) * sizeof (Type)))
187# define xrnew(op,n,Type) ((op) = (Type *) xrealloc ( \
188 (char *) (op), (n) * sizeof (Type)))
189#endif
190 181
191typedef void Lang_function (FILE *); 182typedef void Lang_function (FILE *);
192 183
@@ -348,7 +339,7 @@ static void canonicalize_filename (char *);
348static void linebuffer_init (linebuffer *); 339static void linebuffer_init (linebuffer *);
349static void linebuffer_setlen (linebuffer *, int); 340static void linebuffer_setlen (linebuffer *, int);
350static void *xmalloc (size_t); 341static void *xmalloc (size_t);
351static void *xrealloc (char *, size_t); 342static void *xrealloc (void *, size_t);
352 343
353 344
354static char searchar = '/'; /* use /.../ searches */ 345static char searchar = '/'; /* use /.../ searches */
@@ -6533,7 +6524,7 @@ xmalloc (size_t size)
6533} 6524}
6534 6525
6535static void * 6526static void *
6536xrealloc (char *ptr, size_t size) 6527xrealloc (void *ptr, size_t size)
6537{ 6528{
6538 void *result = realloc (ptr, size); 6529 void *result = realloc (ptr, size);
6539 if (result == NULL) 6530 if (result == NULL)