This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Remove MAX_REGISTER_SIZE from py-unwind.c


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 (齐尧)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]