From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cagney To: gdb-patches@sources.redhat.com Subject: [commit] add xzalloc() Date: Sun, 06 Feb 2005 16:23:00 -0000 Message-id: <4206445C.5040206@gnu.org> X-SW-Source: 2005-02/msg00012.html Fills in a gap, Andrew 2005-02-03 Andrew Cagney * utils.c (xzalloc): New function. * defs.h (XZALLOC): Use xzalloc. (xzalloc): Declare. * value.c (allocate_value): Allocate a zeroed buffer. * mdebugread.c (xzalloc): Delete. Index: defs.h =================================================================== RCS file: /cvs/src/src/gdb/defs.h,v retrieving revision 1.179 diff -p -u -r1.179 defs.h --- defs.h 14 Jan 2005 21:34:35 -0000 1.179 +++ defs.h 6 Feb 2005 15:01:12 -0000 @@ -856,10 +856,13 @@ extern char *savestring (const char *, s "libiberty.h". */ extern void xfree (void *); +/* Like xmalloc, but zero the memory. */ +extern void *xzalloc (size_t); + /* Utility macros to allocate typed memory. Avoids errors like: struct foo *foo = xmalloc (sizeof struct bar); and memset (foo, sizeof (struct foo), 0). */ -#define XZALLOC(TYPE) ((TYPE*) memset (xmalloc (sizeof (TYPE)), 0, sizeof (TYPE))) +#define XZALLOC(TYPE) ((TYPE*) xzalloc (sizeof (TYPE))) #define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE))) #define XCALLOC(NMEMB, TYPE) ((TYPE*) xcalloc ((NMEMB), sizeof (TYPE))) Index: mdebugread.c =================================================================== RCS file: /cvs/src/src/gdb/mdebugread.c,v retrieving revision 1.72 diff -p -u -r1.72 mdebugread.c --- mdebugread.c 14 Jan 2005 00:59:31 -0000 1.72 +++ mdebugread.c 6 Feb 2005 15:01:13 -0000 @@ -297,17 +297,6 @@ static void handle_psymbol_enumerators ( static char *mdebug_next_symbol_text (struct objfile *); -/* Allocate zeroed memory */ - -static void * -xzalloc (unsigned int size) -{ - void *p = xmalloc (size); - - memset (p, 0, size); - return p; -} - /* Exported procedure: Builds a symtab from the PST partial one. Restores the environment in effect when PST was created, delegates most of the work to an ancillary procedure, and sorts Index: utils.c =================================================================== RCS file: /cvs/src/src/gdb/utils.c,v retrieving revision 1.148 diff -p -u -r1.148 utils.c --- utils.c 21 Jan 2005 13:14:01 -0000 1.148 +++ utils.c 6 Feb 2005 15:01:13 -0000 @@ -947,6 +947,12 @@ xmalloc (size_t size) return (val); } +void * +xzalloc (size_t size) +{ + return xcalloc (1, size); +} + PTR /* OK: PTR */ xrealloc (PTR ptr, size_t size) /* OK: PTR */ { Index: value.c =================================================================== RCS file: /cvs/src/src/gdb/value.c,v retrieving revision 1.10 diff -p -u -r1.10 value.c --- value.c 2 Feb 2005 22:34:36 -0000 1.10 +++ value.c 6 Feb 2005 15:01:13 -0000 @@ -83,7 +83,7 @@ allocate_value (struct type *type) struct value *val; struct type *atype = check_typedef (type); - val = (struct value *) xmalloc (sizeof (struct value) + TYPE_LENGTH (atype)); + val = (struct value *) xzalloc (sizeof (struct value) + TYPE_LENGTH (atype)); val->next = all_values; all_values = val; val->type = type; >From me@cgf.cx Sun Feb 06 17:34:00 2005 From: Christopher Faylor To: overseers@sources.redhat.com, gdb-patches@sources.redhat.com, Andrew Cagney Subject: Re: GDB CVS ok; was CVS outage Date: Sun, 06 Feb 2005 17:34:00 -0000 Message-id: <20050206173456.GE13306@trixie.casa.cgf.cx> References: <42064372.3090708@gnu.org> X-SW-Source: 2005-02/msg00013.html Content-length: 332 On Sun, Feb 06, 2005 at 11:18:58AM -0500, Andrew Cagney wrote: >FYI, > >GDB's CVS repository looks ok, thanks! Thanks. I should have mentioned that we were pretty sure that gdb's cvs was ok. I track the gdb-cvs mailing list so we could tell that it was restored properly. But getting independent verification is a relief. cgf From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7706 invoked by alias); 6 Feb 2005 16:23:47 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 7561 invoked from network); 6 Feb 2005 16:23:34 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org with SMTP; 6 Feb 2005 16:23:34 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id j16GNXgq004388 for ; Sun, 6 Feb 2005 11:23:33 -0500 Received: from localhost.redhat.com (vpn50-74.rdu.redhat.com [172.16.50.74]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id j16GNXO25405; Sun, 6 Feb 2005 11:23:33 -0500 Received: from [127.0.0.1] (localhost.localdomain [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id A50067D79; Sun, 6 Feb 2005 11:22:54 -0500 (EST) Message-ID: <4206445C.5040206@gnu.org> Date: Mon, 07 Feb 2005 02:43:00 -0000 From: Andrew Cagney User-Agent: Mozilla Thunderbird 0.8 (X11/20041020) MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: [commit] add xzalloc() Content-Type: multipart/mixed; boundary="------------020702070206020109080303" X-SW-Source: 2005-02/txt/msg00015.txt.bz2 Message-ID: <20050207024300.VcOtnA-R8-XqbJnibBuaMcSdW4UhYoSxygbFSof6RPY@z> This is a multi-part message in MIME format. --------------020702070206020109080303 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 23 Fills in a gap, Andrew --------------020702070206020109080303 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 2928 2005-02-03 Andrew Cagney * utils.c (xzalloc): New function. * defs.h (XZALLOC): Use xzalloc. (xzalloc): Declare. * value.c (allocate_value): Allocate a zeroed buffer. * mdebugread.c (xzalloc): Delete. Index: defs.h =================================================================== RCS file: /cvs/src/src/gdb/defs.h,v retrieving revision 1.179 diff -p -u -r1.179 defs.h --- defs.h 14 Jan 2005 21:34:35 -0000 1.179 +++ defs.h 6 Feb 2005 15:01:12 -0000 @@ -856,10 +856,13 @@ extern char *savestring (const char *, s "libiberty.h". */ extern void xfree (void *); +/* Like xmalloc, but zero the memory. */ +extern void *xzalloc (size_t); + /* Utility macros to allocate typed memory. Avoids errors like: struct foo *foo = xmalloc (sizeof struct bar); and memset (foo, sizeof (struct foo), 0). */ -#define XZALLOC(TYPE) ((TYPE*) memset (xmalloc (sizeof (TYPE)), 0, sizeof (TYPE))) +#define XZALLOC(TYPE) ((TYPE*) xzalloc (sizeof (TYPE))) #define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE))) #define XCALLOC(NMEMB, TYPE) ((TYPE*) xcalloc ((NMEMB), sizeof (TYPE))) Index: mdebugread.c =================================================================== RCS file: /cvs/src/src/gdb/mdebugread.c,v retrieving revision 1.72 diff -p -u -r1.72 mdebugread.c --- mdebugread.c 14 Jan 2005 00:59:31 -0000 1.72 +++ mdebugread.c 6 Feb 2005 15:01:13 -0000 @@ -297,17 +297,6 @@ static void handle_psymbol_enumerators ( static char *mdebug_next_symbol_text (struct objfile *); -/* Allocate zeroed memory */ - -static void * -xzalloc (unsigned int size) -{ - void *p = xmalloc (size); - - memset (p, 0, size); - return p; -} - /* Exported procedure: Builds a symtab from the PST partial one. Restores the environment in effect when PST was created, delegates most of the work to an ancillary procedure, and sorts Index: utils.c =================================================================== RCS file: /cvs/src/src/gdb/utils.c,v retrieving revision 1.148 diff -p -u -r1.148 utils.c --- utils.c 21 Jan 2005 13:14:01 -0000 1.148 +++ utils.c 6 Feb 2005 15:01:13 -0000 @@ -947,6 +947,12 @@ xmalloc (size_t size) return (val); } +void * +xzalloc (size_t size) +{ + return xcalloc (1, size); +} + PTR /* OK: PTR */ xrealloc (PTR ptr, size_t size) /* OK: PTR */ { Index: value.c =================================================================== RCS file: /cvs/src/src/gdb/value.c,v retrieving revision 1.10 diff -p -u -r1.10 value.c --- value.c 2 Feb 2005 22:34:36 -0000 1.10 +++ value.c 6 Feb 2005 15:01:13 -0000 @@ -83,7 +83,7 @@ allocate_value (struct type *type) struct value *val; struct type *atype = check_typedef (type); - val = (struct value *) xmalloc (sizeof (struct value) + TYPE_LENGTH (atype)); + val = (struct value *) xzalloc (sizeof (struct value) + TYPE_LENGTH (atype)); val->next = all_values; all_values = val; val->type = type; --------------020702070206020109080303--