aboutsummaryrefslogtreecommitdiff
path: root/stdio-common
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-07-31 11:14:46 +0000
committerUlrich Drepper <drepper@redhat.com>1998-07-31 11:14:46 +0000
commitc3966b88eeb1e0b5726ca16a70a94269d40ee152 (patch)
tree01b5267fea81493dda40ddbad0391c4a35c19c76 /stdio-common
parentbdd421cc6d055af6a1a561344b2fa56267cad617 (diff)
downloadglibc-c3966b88eeb1e0b5726ca16a70a94269d40ee152.zip
glibc-c3966b88eeb1e0b5726ca16a70a94269d40ee152.tar.gz
glibc-c3966b88eeb1e0b5726ca16a70a94269d40ee152.tar.bz2
Update.
1998-07-31 11:10 Ulrich Drepper <drepper@cygnus.com> * elf/elf.h: Add lots of new symbols from Irix and Solaris. * sysdeps/unix/sysv/linux/sigstack.c: Include stddef.h to get NULL definition. 1998-07-31 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * sunrpc/xcrypt.c: Use only the first 8 characters of the password. 1998-07-30 21:06 -0400 Zack Weinberg <zack@rabi.phys.columbia.edu> * sysdeps/generic/glob.c: Undefine strdup before defining it, because bits/string2.h may have defined it already. 1998-07-29 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * stdio-common/vfscanf.c: Optimize looking for type modifiers. Fix recognition of 'a' modifier vs. 'a' format. (TYPEMOD): Removed. * stdio-common/printf-parse.h (parse_one_spec): Optimize looking for type modifiers. Fix recognition of 'hh' modifier. 1998-07-31 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * sunrpc/svc_unix.c: Fix typo. 1998-07-31 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * sysdeps/unix/sysv/linux/recvmsg.c: Don't check for SCM_CREDS before syscall.
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/printf-parse.h94
-rw-r--r--stdio-common/vfscanf.c141
2 files changed, 109 insertions, 126 deletions
diff --git a/stdio-common/printf-parse.h b/stdio-common/printf-parse.h
index 61468eb..4f217ab 100644
--- a/stdio-common/printf-parse.h
+++ b/stdio-common/printf-parse.h
@@ -271,54 +271,54 @@ parse_one_spec (const UCHAR_T *format, size_t posn, struct printf_spec *spec,
spec->info.is_long = 0;
spec->info.is_char = 0;
- if (*format == L_('h') || *format == L_('l') || *format == L_('L') ||
- *format == L_('Z') || *format == L_('q') || *format == L_('z') ||
- *format == L_('t') || *format == L_('j'))
- switch (*format++)
- {
- case L_('h'):
- /* int's are short int's. */
- if (spec->info.is_short == 0)
- spec->info.is_short = 1;
- else
- {
- spec->info.is_short = 0;
- spec->info.is_char = 1;
- }
- break;
- case L_('l'):
- /* int's are long int's. */
- spec->info.is_long = 1;
- if (*format != L_('l'))
- break;
- ++format;
- /* FALLTHROUGH */
- case L_('L'):
- /* double's are long double's, and int's are long long int's. */
- case L_('q'):
- /* 4.4 uses this for long long. */
- spec->info.is_long_double = 1;
- break;
- case L_('z'):
- case L_('Z'):
- /* int's are size_t's. */
- assert (sizeof (size_t) <= sizeof (unsigned long long int));
- spec->info.is_longlong = sizeof (size_t) > sizeof (unsigned long int);
- spec->info.is_long = sizeof (size_t) > sizeof (unsigned int);
- break;
- case L_('t'):
- assert (sizeof (ptrdiff_t) <= sizeof (unsigned long long int));
- spec->info.is_longlong = (sizeof (ptrdiff_t)
- > sizeof (unsigned long int));
- spec->info.is_long = sizeof (ptrdiff_t) > sizeof (unsigned int);
- break;
- case L_('j'):
- assert (sizeof (intmax_t) <= sizeof (unsigned long long int));
- spec->info.is_longlong = (sizeof (intmax_t)
- > sizeof (unsigned long int));
- spec->info.is_long = sizeof (intmax_t) > sizeof (unsigned int);
+ switch (*format++)
+ {
+ case L_('h'):
+ /* ints are short ints or chars. */
+ if (*format != L_('h'))
+ spec->info.is_short = 1;
+ else
+ {
+ ++format;
+ spec->info.is_char = 1;
+ }
+ break;
+ case L_('l'):
+ /* ints are long ints. */
+ spec->info.is_long = 1;
+ if (*format != L_('l'))
break;
- }
+ ++format;
+ /* FALLTHROUGH */
+ case L_('L'):
+ /* doubles are long doubles, and ints are long long ints. */
+ case L_('q'):
+ /* 4.4 uses this for long long. */
+ spec->info.is_long_double = 1;
+ break;
+ case L_('z'):
+ case L_('Z'):
+ /* ints are size_ts. */
+ assert (sizeof (size_t) <= sizeof (unsigned long long int));
+ spec->info.is_longlong = sizeof (size_t) > sizeof (unsigned long int);
+ spec->info.is_long = sizeof (size_t) > sizeof (unsigned int);
+ break;
+ case L_('t'):
+ assert (sizeof (ptrdiff_t) <= sizeof (long long int));
+ spec->info.is_longlong = (sizeof (ptrdiff_t) > sizeof (long int));
+ spec->info.is_long = sizeof (ptrdiff_t) > sizeof (int);
+ break;
+ case L_('j'):
+ assert (sizeof (uintmax_t) <= sizeof (unsigned long long int));
+ spec->info.is_longlong = (sizeof (uintmax_t)
+ > sizeof (unsigned long int));
+ spec->info.is_long = sizeof (uintmax_t) > sizeof (unsigned int);
+ break;
+ default:
+ /* Not a recognized modifier. Backup. */
+ --format;
+ break;
+ }
/* Get the format specification. */
spec->info.spec = (wchar_t) *format++;
diff --git a/stdio-common/vfscanf.c b/stdio-common/vfscanf.c
index ce5e512..116b19b 100644
--- a/stdio-common/vfscanf.c
+++ b/stdio-common/vfscanf.c
@@ -47,8 +47,6 @@
# define MALLOC 0x100 /* a: malloc strings */
# define CHAR 0x200 /* hh: char */
-# define TYPEMOD (LONG|LONGDBL|SHORT|CHAR)
-
#ifdef USE_IN_LIBIO
# include <libioP.h>
@@ -408,84 +406,69 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
width = -1;
/* Check for type modifiers. */
- while (*f == 'h' || *f == 'l' || *f == 'L' || *f == 'a' || *f == 'q'
- || *f == 'z' || *f == 't' || *f == 'j')
- switch (*f++)
- {
- case 'h':
- /* int's are short int's. */
- if (flags & (LONG|LONGDBL|CHAR))
- /* Signal illegal format element. */
- conv_error ();
- if (flags & SHORT)
- {
- flags &= ~SHORT;
- flags |= CHAR;
- }
- else
- flags |= SHORT;
- break;
- case 'l':
- if (flags & (SHORT|LONGDBL|CHAR))
- conv_error ();
- else if (flags & LONG)
- {
- /* A double `l' is equivalent to an `L'. */
- flags &= ~LONG;
- flags |= LONGDBL;
- }
- else
- /* int's are long int's. */
- flags |= LONG;
- break;
- case 'q':
- case 'L':
- /* double's are long double's, and int's are long long int's. */
- if (flags & TYPEMOD)
- /* Signal illegal format element. */
- conv_error ();
- flags |= LONGDBL;
- break;
- case 'a':
- /* The `a' is used as a flag only if followed by `s', `S' or
- `['. */
- if (*f != 's' && *f != 'S' && *f != '[')
- {
- --f;
- break;
- }
- if (flags & TYPEMOD)
- /* Signal illegal format element. */
- conv_error ();
- /* String conversions (%s, %[) take a `char **'
- arg and fill it in with a malloc'd pointer. */
- flags |= MALLOC;
- break;
- case 'z':
- if (flags & (SHORT|LONGDBL|CHAR))
- conv_error ();
- if (sizeof (size_t) > sizeof (unsigned long int))
- flags |= LONGDBL;
- else if (sizeof (size_t) > sizeof (unsigned int))
- flags |= LONG;
- break;
- case 'j':
- if (flags & (SHORT|LONGDBL|CHAR))
- conv_error ();
- if (sizeof (intmax_t) > sizeof (unsigned long int))
- flags |= LONGDBL;
- else if (sizeof (intmax_t) > sizeof (unsigned int))
- flags |= LONG;
- break;
- case 't':
- if (flags & (SHORT|LONGDBL|CHAR))
- conv_error ();
- if (sizeof (ptrdiff_t) > sizeof (unsigned long int))
+ switch (*f++)
+ {
+ case 'h':
+ /* ints are short ints or chars. */
+ if (*f == 'h')
+ {
+ ++f;
+ flags |= CHAR;
+ }
+ else
+ flags |= SHORT;
+ break;
+ case 'l':
+ if (*f == 'l')
+ {
+ /* A double `l' is equivalent to an `L'. */
+ ++f;
flags |= LONGDBL;
- else if (sizeof (ptrdiff_t) > sizeof (unsigned int))
- flags |= LONG;
- break;
- }
+ }
+ else
+ /* ints are long ints. */
+ flags |= LONG;
+ break;
+ case 'q':
+ case 'L':
+ /* doubles are long doubles, and ints are long long ints. */
+ flags |= LONGDBL;
+ break;
+ case 'a':
+ /* The `a' is used as a flag only if followed by `s', `S' or
+ `['. */
+ if (*f != 's' && *f != 'S' && *f != '[')
+ {
+ --f;
+ break;
+ }
+ /* String conversions (%s, %[) take a `char **'
+ arg and fill it in with a malloc'd pointer. */
+ flags |= MALLOC;
+ break;
+ case 'z':
+ if (sizeof (size_t) > sizeof (unsigned long int))
+ flags |= LONGDBL;
+ else if (sizeof (size_t) > sizeof (unsigned int))
+ flags |= LONG;
+ break;
+ case 'j':
+ if (sizeof (uintmax_t) > sizeof (unsigned long int))
+ flags |= LONGDBL;
+ else if (sizeof (uintmax_t) > sizeof (unsigned int))
+ flags |= LONG;
+ break;
+ case 't':
+ if (sizeof (ptrdiff_t) > sizeof (long int))
+ flags |= LONGDBL;
+ else if (sizeof (ptrdiff_t) > sizeof (int))
+ flags |= LONG;
+ break;
+ default:
+ /* Not a recognized modifier. Backup. */
+ --f;
+ break;
+ }
/* End of the format string? */
if (*f == '\0')