vasnprintf: Reduce use of malloc for small format strings.
authorBruno Haible <bruno@clisp.org>
Fri, 4 Feb 2011 18:22:43 +0000 (19:22 +0100)
committerBruno Haible <bruno@clisp.org>
Fri, 4 Feb 2011 18:22:43 +0000 (19:22 +0100)
commit8c6ae0f8ac5b35f5237375dfe748300544711701
tree015202934c1905796185ec1eefff89020454544a
parentb6b8999acb7d09d22a2ea4809ec4de041d761f05
vasnprintf: Reduce use of malloc for small format strings.

* lib/printf-args.h (N_DIRECT_ALLOC_ARGUMENTS): New macro.
(arguments): Add room for the first 7 arguments.
* lib/printf-parse.h (N_DIRECT_ALLOC_DIRECTIVES): New macro.
(char_directives, u8_directives, u16_directives, u32_directives): Add
room for the first 7 directives.
* lib/printf-parse.c: Include <string.h>.
(PRINTF_PARSE): Change memory handling code so that it uses the first
7 preallocated elements in an 'arguments' or 'DIRECTIVES' struct.
* lib/vasnprintf.c (VASNPRINTF): Update memory handling code.
Reported by Pádraig Brady <P@draigbrady.com>.
ChangeLog
lib/printf-args.h
lib/printf-parse.c
lib/printf-parse.h
lib/vasnprintf.c