This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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 v4] Replace use of snprintf with strfrom in libm tests


On Tue, 20 Dec 2016, Gabriel F. T. Gomes wrote:

> +  /* Add a space to the beginning of the output string, if the floating-point
> +     number is non-negative.  This mimics the behavior of the space (' ') flag
> +     in snprintf, which is not available on strfrom.  */
> +  if (! signbit (value))
> +    {
> +      *dest = ' ';
> +      dest++;

You should also have "size--;" in here, so that the size passed to the 
strfrom function accurately reflects the size left in dest after the space 
was inserted.

The patch is OK with that change.

-- 
Joseph S. Myers
joseph@codesourcery.com


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