[RFA/ARI fix] Remove use of abort function in common/buffer.c

Pedro Alves palves@redhat.com
Tue May 22 09:34:00 GMT 2012


On 05/22/2012 10:17 AM, Pierre Muller wrote:

>   ARI clearly states that abort function
> should never be used, and to use internal_error
> instead.
> 
>   I first suspected that this was related to missing declarations in 
> common directory, but internal_error does
> exist there also.
> 
>   Finally, looking at common/buffer.c source, I found that
> gdb_assert was probably a better fit here
> (the macro does call internal_error).
> 
> 
>   Is this patch OK or what else should we use here?


We should just remove the abort; it's dead code.  xrealloc already handles
that for us.  common/common-utils.c:xrealloc:

...
  /* (...) It never returns NULL.  */
...
  if (val == NULL)
    malloc_failure (size);

  return val;
}

-- 
Pedro Alves



More information about the Gdb-patches mailing list