From 082faf240ec27a125674eed0782a50cbb2aed512 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Sat, 4 Mar 2000 02:23:06 +0000 Subject: [PATCH] Make mmalloc functions consistent. Some need ISO-C others need PTR :-(. --- gdb/ChangeLog | 6 ++++++ gdb/defs.h | 5 ++++- gdb/utils.c | 19 ++++++------------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a8da805..0e13040 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +Sat Mar 4 13:02:09 2000 Andrew Cagney + + * utils.c (mcalloc), defs.h (mcalloc): Keep consistent with + "mmalloc.h" which means using PTRs. + (init_malloc, msavestring, mstrsave): Convert to PTR free ISO-C. + Sat Mar 4 11:49:21 2000 Andrew Cagney * defs.h (store_address, store_unsigned_integer, store_address): diff --git a/gdb/defs.h b/gdb/defs.h index 8a06f58..9248c76 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -341,7 +341,10 @@ extern int myread (int, char *, int); extern int query (char *, ...) ATTR_FORMAT (printf, 1, 2); #if !defined (USE_MMALLOC) -extern PTR mcalloc (void *, size_t, size_t); +/* NOTE: cagney/2000-03-04: The mmalloc functions need to use PTR + rather than void* so that they are consistent with + ../mmalloc/mmalloc.h. */ +extern PTR mcalloc (PTR, size_t, size_t); extern PTR mmalloc (PTR, size_t); extern PTR mrealloc (PTR, PTR, size_t); extern void mfree (PTR, PTR); diff --git a/gdb/utils.c b/gdb/utils.c index a4686bb..a752f71 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -919,8 +919,8 @@ request_quit (signo) #if !defined (USE_MMALLOC) -void * -mcalloc (void *md, size_t number, size_t size) +PTR +mcalloc (PTR md, size_t number, size_t size) { return calloc (number, size); } @@ -958,8 +958,7 @@ mfree (md, ptr) #if !defined (USE_MMALLOC) || defined (NO_MMCHECK) void -init_malloc (md) - PTR md; +init_malloc (void *md) { } @@ -991,8 +990,7 @@ malloc_botch () #endif void -init_malloc (md) - PTR md; +init_malloc (void *md) { if (!mmcheckf (md, malloc_botch, MMCHECK_FORCE)) { @@ -1149,10 +1147,7 @@ savestring (ptr, size) } char * -msavestring (md, ptr, size) - PTR md; - const char *ptr; - int size; +msavestring (void *md, const char *ptr, int size) { register char *p = (char *) xmmalloc (md, size + 1); memcpy (p, ptr, size); @@ -1171,9 +1166,7 @@ strsave (ptr) } char * -mstrsave (md, ptr) - PTR md; - const char *ptr; +mstrsave (void *md, const char *ptr) { return (msavestring (md, ptr, strlen (ptr))); } -- 2.7.4