This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Remove MAX_REGISTER_SIZE from py-unwind.c
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Alan Hayward <Alan dot Hayward at arm dot com>
- Cc: "gdb-patches\@sourceware.org" <gdb-patches at sourceware dot org>, nd <nd at arm dot com>
- Date: Thu, 22 Jun 2017 10:08:41 +0100
- Subject: Re: [PATCH] Remove MAX_REGISTER_SIZE from py-unwind.c
- Authentication-results: sourceware.org; auth=none
- References: <E4218BDE-2A92-490F-9443-27E25F4237C4@arm.com>
Alan Hayward <Alan.Hayward@arm.com> writes:
> cached_frame
> - = ((cached_frame_info *)
> - xmalloc (sizeof (*cached_frame)
> - + reg_count * sizeof (cached_frame->reg[0])));
> + = ((cached_frame_info *) xmalloc (sizeof (*cached_frame)));
Use XNEW, the code can be shorter,
> @@ -601,6 +591,13 @@ static void
> pyuw_dealloc_cache (struct frame_info *this_frame, void *cache)
> {
> TRACE_PY_UNWIND (3, "%s: enter", __FUNCTION__);
> + cached_frame_info *cached_frame = (cached_frame_info *) cache;
> +
> + for (int i = 0; cached_frame->reg_count; i++)
> + {
> + xfree (cached_frame->reg[i].data);
> + }
No need to use braces.
Otherwise, patch is good to me.
--
Yao (齐尧)