mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 17:18:55 +00:00
* utils.c (xmalloc,xcalloc,xstrdup): New fns.
* server.h (ATTR_MALLOC): New macro. (xmalloc,xcalloc,xstrdup): Declare. * hostio.c: Replace malloc,calloc,strdup with xmalloc,xcalloc,xstrdup. * inferiors.c: Ditto. * linux-low.c: Ditto. * mem-break.c: Ditto. * regcache.c: Ditto. * remote-utils.c: Ditto. * server.c: Ditto. * target.c: Ditto. * win32-low.c: Ditto.
This commit is contained in:
@@ -70,6 +70,14 @@ extern void *memmem (const void *, size_t , const void *, size_t);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ATTR_MALLOC
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 3)
|
||||
#define ATTR_MALLOC __attribute__ ((__malloc__))
|
||||
#else
|
||||
#define ATTR_MALLOC /* nothing */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* A type used for binary buffers. */
|
||||
typedef unsigned char gdb_byte;
|
||||
|
||||
@@ -265,6 +273,9 @@ char *target_signal_to_name (enum target_signal);
|
||||
|
||||
/* Functions from utils.c */
|
||||
|
||||
void *xmalloc (size_t) ATTR_MALLOC;
|
||||
void *xcalloc (size_t, size_t) ATTR_MALLOC;
|
||||
char *xstrdup (const char *) ATTR_MALLOC;
|
||||
void perror_with_name (char *string);
|
||||
void error (const char *string,...) ATTR_NORETURN ATTR_FORMAT (printf, 1, 2);
|
||||
void fatal (const char *string,...) ATTR_NORETURN ATTR_FORMAT (printf, 1, 2);
|
||||
|
||||
Reference in New Issue
Block a user