1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-07 06:43:00 +03:00

stdio-common: Simplify printf_unknown interface in vfprintf-internal.c

The called function does not use the args array, so there is no need
to produce it.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
This commit is contained in:
Florian Weimer
2022-05-24 08:03:11 +02:00
parent 46db978347
commit fe8ca369ad

View File

@@ -672,8 +672,7 @@ static int printf_positional (FILE *s,
unsigned int mode_flags); unsigned int mode_flags);
/* Handle unknown format specifier. */ /* Handle unknown format specifier. */
static int printf_unknown (FILE *, const struct printf_info *, static int printf_unknown (FILE *, const struct printf_info *) __THROW;
const void *const *) __THROW;
/* Group digits of number string. */ /* Group digits of number string. */
static CHAR_T *group_number (CHAR_T *, CHAR_T *, CHAR_T *, const char *, static CHAR_T *group_number (CHAR_T *, CHAR_T *, CHAR_T *, const char *,
@@ -1465,19 +1464,7 @@ printf_positional (FILE *s, const CHAR_T *format, int readonly_format,
LABEL (form_unknown): LABEL (form_unknown):
{ {
unsigned int i; int function_done = printf_unknown (s, &specs[nspecs_done].info);
const void **ptr;
ptr = alloca (specs[nspecs_done].ndata_args
* sizeof (const void *));
/* Fill in an array of pointers to the argument values. */
for (i = 0; i < specs[nspecs_done].ndata_args; ++i)
ptr[i] = &args_value[specs[nspecs_done].data_arg + i];
/* Call the function. */
function_done = printf_unknown (s, &specs[nspecs_done].info,
ptr);
/* If an error occurred we don't have information about # /* If an error occurred we don't have information about #
of chars. */ of chars. */
@@ -1507,9 +1494,7 @@ printf_positional (FILE *s, const CHAR_T *format, int readonly_format,
/* Handle an unknown format specifier. This prints out a canonicalized /* Handle an unknown format specifier. This prints out a canonicalized
representation of the format spec itself. */ representation of the format spec itself. */
static int static int
printf_unknown (FILE *s, const struct printf_info *info, printf_unknown (FILE *s, const struct printf_info *info)
const void *const *args)
{ {
int done = 0; int done = 0;
CHAR_T work_buffer[MAX (sizeof (info->width), sizeof (info->prec)) * 3]; CHAR_T work_buffer[MAX (sizeof (info->width), sizeof (info->prec)) * 3];