aboutsummaryrefslogtreecommitdiff
path: root/gdb/defs.h
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2001-03-23 23:39:57 +0000
committerAndrew Cagney <cagney@redhat.com>2001-03-23 23:39:57 +0000
commitc0e61796d0ad9af35747d8b3b1aaad03e13fd0e4 (patch)
tree3b1309bddef80b706d1f5eabbbc7db5533ad61f8 /gdb/defs.h
parentc20ec07b9a527782998d094dd3099b7f6c48fd8e (diff)
downloadfsf-binutils-gdb-c0e61796d0ad9af35747d8b3b1aaad03e13fd0e4.zip
fsf-binutils-gdb-c0e61796d0ad9af35747d8b3b1aaad03e13fd0e4.tar.gz
fsf-binutils-gdb-c0e61796d0ad9af35747d8b3b1aaad03e13fd0e4.tar.bz2
* defs.h (xfree, mcalloc, mmalloc, mrealloc, mfree, xmmalloc,
xmrealloc): Move existing declarations to the one place and re-order to be consistent. (xmcalloc, xmfree): Declare. (xmmalloc, xmrealoc): Assume ISO-C - use size_t and void* in declaration. * utils.c (size_t): Delete #ifdef defining size_t. (mmalloc, mrealloc, mcalloc, mfree): Re-order. (mmalloc, mrealloc, mcalloc): Document as only calls in GDB corresponding malloc, realloc, calloc. (mfree): Call free directly. (xmmalloc, xmrealloc): Clean up. Assume ISO-C. (xmcalloc, xmfree): New functions. Copy old xcalloc and xfree function bodies to here. (xcalloc, xfree): Call xmcalloc and xmfree respectfully.
Diffstat (limited to 'gdb/defs.h')
-rw-r--r--gdb/defs.h39
1 files changed, 19 insertions, 20 deletions
diff --git a/gdb/defs.h b/gdb/defs.h
index 8905698..72f5184 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -510,22 +510,10 @@ extern void free_current_contents (void *);
extern void null_cleanup (void *);
-extern void xfree (void *);
-
extern int myread (int, char *, int);
extern int query (char *, ...) ATTR_FORMAT (printf, 1, 2);
-#if !defined (USE_MMALLOC)
-/* 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);
-#endif
-
extern void init_page_info (void);
extern CORE_ADDR host_pointer_to_address (void *ptr);
@@ -953,16 +941,27 @@ extern char *msavestring (void *, const char *, size_t);
extern char *mstrsave (void *, const char *);
-/* FIXME; was long, but this causes compile errors in msvc if already
- defined */
-#ifdef _MSC_VER
-extern PTR xmmalloc (PTR, size_t);
-extern PTR xmrealloc (PTR, PTR, size_t);
-#else
-extern PTR xmmalloc (PTR, long);
-extern PTR xmrealloc (PTR, PTR, long);
+#if !defined (USE_MMALLOC)
+/* NOTE: cagney/2000-03-04: The mmalloc functions need to use PTR
+ rather than void* so that they are consistent with the delcaration
+ in ../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);
#endif
+/* Robust versions of same. Throw an internal error when no memory,
+ guard against stray NULL arguments. */
+extern void *xmmalloc (void *md, size_t size);
+extern void *xmrealloc (void *md, void *ptr, size_t size);
+extern void *xmcalloc (void *md, size_t number, size_t size);
+extern void xmfree (void *md, void *ptr);
+
+/* xmalloc(), xrealloc() and xcalloc() have already been declared in
+ "libiberty.h". */
+extern void xfree (void *);
+
/* Like asprintf/vasprintf but get an internal_error if the call
fails. */
extern void xasprintf (char **ret, const char *format, ...) ATTR_FORMAT (printf, 2, 3);