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] gdb/ada-lang.c: one malloc -> unique_ptr<[]>


> Switching gdb to use gnulib's C++ namespace mode reveals we're calling
> malloc instead of xmalloc here:
> 
>  ..../src/gdb/ada-lang.c: In function ‘value* ada_value_primitive_packed_val(value*, const gdb_byte*, long int, int, int, type*)’:
>  ..../src/gdb/ada-lang.c:2592:50: error: call to ‘malloc’ declared with attribute warning: The symbol ::malloc refers to the system function. Use gnulib::malloc instead. [-Werror]
> 	staging = (gdb_byte *) malloc (staging_len);

Humpf. Oversight on my part.

> Since we want to get rid of all cleanups, fix this by switching to
> new[] and unique_ptr<[]> instead, while at it.
> 
> Regtested on Fedora 23.
> 
> gdb/ChangeLog:
> yyyy-mm-dd  Pedro Alves  <palves@redhat.com>
> 
> 	* ada-lang.c (ada_value_primitive_packed_val): Use unique_ptr and
> 	new gdb_byte[] instead of malloc and cleanups.

I think I understand the patch, and it looks good to me.
Thanks, Pedro.

-- 
Joel


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