This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: implement fdiagnostics-print-source-range-info


2009/8/4 Joseph S. Myers <joseph@codesourcery.com>:
> On Tue, 4 Aug 2009, Manuel López-Ibáñez wrote:
>
>> + ?if (flag_show_ranges && num_ranges)
>> + ? ?{
>> + ? ? ?int i;
>> + ? ? ?char * rangestr = NULL;
>> + ? ? ?char * tmpstr;
>> +
>> + ? ? ?asprintf(&tmpstr, "%s", "");
>
> You need to check the return value of asprintf (tmpstr is undefined if
> asprintf fails), and note the space needed before "(".

What is the proper way to fail if the return value is not positive? I
see other uses of asprintf and vasprintf but none of them actually
check their return value.

Cheers,

Manuel.


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