This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] use memset to zero the fields of a new frame_info
- To: gdb-patches at sources dot redhat dot com
- Subject: [PATCH] use memset to zero the fields of a new frame_info
- From: Michael Snyder <msnyder at cygnus dot com>
- Date: Thu, 17 May 2001 13:08:52 -0700
- Organization: Red Hat
One call to memset does a better job than some number of individual assigns,
esp. since it's guaranteed to get new fields that would be missed otherwise
(and were being).
2001-05-17 Michael Snyder <msnyder@redhat.com>
* blockframe.c (create_new_frame): Zero all the fields via memset,
rather than zeroing them one by one.
Index: blockframe.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/blockframe.c,v
retrieving revision 1.111
diff -c -3 -p -r1.111 blockframe.c
*** blockframe.c 2001/05/09 00:19:04 1.111
--- blockframe.c 2001/05/17 19:59:08
*************** create_new_frame (CORE_ADDR addr, CORE_A
*** 219,228 ****
obstack_alloc (&frame_cache_obstack,
sizeof (struct frame_info));
/* Arbitrary frame */
- fi->saved_regs = NULL;
- fi->next = NULL;
- fi->prev = NULL;
fi->frame = addr;
fi->pc = pc;
find_pc_partial_function (pc, &name, (CORE_ADDR *) NULL, (CORE_ADDR *) NULL);
--- 219,227 ----
obstack_alloc (&frame_cache_obstack,
sizeof (struct frame_info));
+ /* Zero all fields by default. */
+ memset (fi, 0, sizeof (struct frame_info));
/* Arbitrary frame */
fi->frame = addr;
fi->pc = pc;
find_pc_partial_function (pc, &name, (CORE_ADDR *) NULL, (CORE_ADDR *) NULL);