[PATCH] stdio-common/vfprintf.c: Remove magic number 32.

Florian Weimer fweimer@redhat.com
Tue May 30 08:56:00 GMT 2017


On 05/04/2017 06:26 PM, Carlos O'Donell wrote:
> I was looking at modifying some of this code for a bug I was working
> on and it was super annoying that the 32 character buffer is hardcoded
> everywhere. This patch simply hoists this into a macro EXTSIZ.
> 
> I'll check this in within 24h if nobody objects.
> 
> 2017-05-04  Carlos O'Donell  <carlos@redhat.com>
> 
> 	* stdio-common/vfprintf.c (EXTSIZ): Define.
> 	(vfprintf): Use EXTSIZ.
> 	(printf_positional): Likewise.

I looked at this and discovered that since 1999, we no longer use the
work buffer for padding purposes, so resizing it based on field width is
no longer needed.  The attached patch removes the resizing logic.

We could probably reduce the size of the work buffer, too, and we should
have some checks that a funny locale does not produce number formatting
rules which exceed the buffer size.

(Floating point formatting does not use the work buffer.)

Thanks,
Florian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: work_buffer.patch
Type: text/x-patch
Size: 9665 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20170530/606afb80/attachment.bin>


More information about the Libc-alpha mailing list