* [PATCH] Remove pa_char, pa_short_int, pa_u_short_int and pa_float
@ 2003-05-27 7:30 Jakub Jelinek
2003-05-27 8:03 ` Ulrich Drepper
0 siblings, 1 reply; 2+ messages in thread
From: Jakub Jelinek @ 2003-05-27 7:30 UTC (permalink / raw)
To: Ulrich Drepper, Roland McGrath; +Cc: Glibc hackers
Hi!
Now that vfprintf always sets pa_int (resp. pa_double) instead of these
union members, we shouldn't read from them either.
Tested on ppc-linux.
2003-05-27 Jakub Jelinek <jakub@redhat.com>
* stdio-common/vfprintf.c (process_arg, process_string_arg): Use
pa_int/pa_u_int instead of pa_short_int, pa_u_short_int and pa_char.
* stdio-common/printf-parse.h (union printf_arg): Remove pa_char,
pa_short_int, pa_u_short_int and pa_float.
--- libc/stdio-common/vfprintf.c.jj 2003-05-26 09:44:31.000000000 -0400
+++ libc/stdio-common/vfprintf.c 2003-05-26 20:18:03.000000000 -0400
@@ -581,10 +581,8 @@ vfprintf (FILE *s, const CHAR_T *format,
else \
if (is_long_num) \
signed_number = args_value[fspec->data_arg].pa_long_int; \
- else if (!is_short) \
+ else /* `char' and `short int' will be promoted to `int'. */ \
signed_number = args_value[fspec->data_arg].pa_int; \
- else \
- signed_number = args_value[fspec->data_arg].pa_short_int; \
\
is_negative = signed_number < 0; \
number.word = is_negative ? (- signed_number) : signed_number; \
@@ -675,12 +673,12 @@ vfprintf (FILE *s, const CHAR_T *format,
number.word = args_value[fspec->data_arg].pa_u_long_int; \
else if (is_char) \
number.word = (unsigned char) \
- args_value[fspec->data_arg].pa_char; \
+ args_value[fspec->data_arg].pa_u_int; \
else if (!is_short) \
number.word = args_value[fspec->data_arg].pa_u_int; \
else \
number.word = (unsigned short int) \
- args_value[fspec->data_arg].pa_u_short_int; \
+ args_value[fspec->data_arg].pa_u_int; \
\
LABEL (number): \
if (prec < 0) \
@@ -977,7 +975,7 @@ vfprintf (FILE *s, const CHAR_T *format,
outchar (__btowc ((unsigned char) va_arg (ap, int))); /* Promoted. */ \
else \
outchar (__btowc ((unsigned char) \
- args_value[fspec->data_arg].pa_char)); \
+ args_value[fspec->data_arg].pa_int)); \
if (left) \
PAD (L' '); \
break; \
@@ -1096,7 +1094,7 @@ vfprintf (FILE *s, const CHAR_T *format,
if (fspec == NULL) \
outchar ((unsigned char) va_arg (ap, int)); /* Promoted. */ \
else \
- outchar ((unsigned char) args_value[fspec->data_arg].pa_char); \
+ outchar ((unsigned char) args_value[fspec->data_arg].pa_int); \
if (left) \
PAD (' '); \
break; \
--- libc/stdio-common/printf-parse.h.jj 2002-11-05 17:10:28.000000000 -0500
+++ libc/stdio-common/printf-parse.h 2003-05-26 20:14:46.000000000 -0400
@@ -51,17 +51,13 @@ struct printf_spec
/* The various kinds off arguments that can be passed to printf. */
union printf_arg
{
- unsigned char pa_char;
wchar_t pa_wchar;
- short int pa_short_int;
int pa_int;
long int pa_long_int;
long long int pa_long_long_int;
- unsigned short int pa_u_short_int;
unsigned int pa_u_int;
unsigned long int pa_u_long_int;
unsigned long long int pa_u_long_long_int;
- float pa_float;
double pa_double;
long double pa_long_double;
const char *pa_string;
Jakub
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Remove pa_char, pa_short_int, pa_u_short_int and pa_float
2003-05-27 7:30 [PATCH] Remove pa_char, pa_short_int, pa_u_short_int and pa_float Jakub Jelinek
@ 2003-05-27 8:03 ` Ulrich Drepper
0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2003-05-27 8:03 UTC (permalink / raw)
To: Jakub Jelinek; +Cc: Glibc hackers
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jakub Jelinek wrote:
> 2003-05-27 Jakub Jelinek <jakub@redhat.com>
>
> * stdio-common/vfprintf.c (process_arg, process_string_arg): Use
> pa_int/pa_u_int instead of pa_short_int, pa_u_short_int and pa_char.
> * stdio-common/printf-parse.h (union printf_arg): Remove pa_char,
> pa_short_int, pa_u_short_int and pa_float.
Applied. Thanks,
- --
- --------------. ,-. 444 Castro Street
Ulrich Drepper \ ,-----------------' \ Mountain View, CA 94041 USA
Red Hat `--' drepper at redhat.com `---------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+0xuV2ijCOnn/RHQRAnnCAKCkzNuRr1oWZEW5Gj19A1+PWsSSzwCeIsLS
8QupYIdpcYP/g0ZXrOkFSWY=
=WkWu
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-05-27 8:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-05-27 7:30 [PATCH] Remove pa_char, pa_short_int, pa_u_short_int and pa_float Jakub Jelinek
2003-05-27 8:03 ` Ulrich Drepper
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).