summaryrefslogtreecommitdiff
path: root/lib/printf-parse.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2022-01-08 11:51:07 +0100
committerJörg Frings-Fürst <debian@jff.email>2022-01-08 11:51:07 +0100
commitbe8efac78d067c138ad8dda03df4336e73f94887 (patch)
tree5f5254a628ba0ef72065b93d949d1c985742ea8e /lib/printf-parse.c
parent7b65dbd4ebade81d504cfe5e681292a58ad1fdf0 (diff)
New upstream version 1.0upstream/1.0
Diffstat (limited to 'lib/printf-parse.c')
-rw-r--r--lib/printf-parse.c62
1 files changed, 19 insertions, 43 deletions
diff --git a/lib/printf-parse.c b/lib/printf-parse.c
index b61841bb..aab02dc5 100644
--- a/lib/printf-parse.c
+++ b/lib/printf-parse.c
@@ -1,27 +1,18 @@
/* Formatted output to strings.
- Copyright (C) 1999-2000, 2002-2003, 2006-2018 Free Software Foundation, Inc.
+ Copyright (C) 1999-2000, 2002-2003, 2006-2022 Free Software Foundation, Inc.
- This program is free software: you can redistribute it and/or
- modify it under the terms of either:
+ This file is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as
+ published by the Free Software Foundation; either version 2.1 of the
+ License, or (at your option) any later version.
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
- or
-
- * the GNU General Public License as published by the Free
- Software Foundation; either version 2 of the License, or (at your
- option) any later version.
-
- or both in parallel, as here.
- This program is distributed in the hope that it will be useful,
+ This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License along
- with this program; if not, see <https://www.gnu.org/licenses/>. */
+ You should have received a copy of the GNU Lesser General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* This file can be parametrized with the following macros:
CHAR_T The element type of the format string.
@@ -57,16 +48,7 @@
#include <stddef.h>
/* Get intmax_t. */
-#if defined IN_LIBINTL || defined IN_LIBASPRINTF
-# if HAVE_STDINT_H_WITH_UINTMAX
-# include <stdint.h>
-# endif
-# if HAVE_INTTYPES_H_WITH_UINTMAX
-# include <inttypes.h>
-# endif
-#else
-# include <stdint.h>
-#endif
+#include <stdint.h>
/* malloc(), realloc(), free(). */
#include <stdlib.h>
@@ -456,14 +438,12 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
switch (c)
{
case 'd': case 'i':
-#if HAVE_LONG_LONG_INT
- /* If 'long long' exists and is larger than 'long': */
+ /* If 'long long' is larger than 'long': */
if (flags >= 16 || (flags & 4))
type = TYPE_LONGLONGINT;
else
-#endif
- /* If 'long long' exists and is the same as 'long', we parse
- "lld" into TYPE_LONGINT. */
+ /* If 'long long' is the same as 'long', we parse "lld" into
+ TYPE_LONGINT. */
if (flags >= 8)
type = TYPE_LONGINT;
else if (flags & 2)
@@ -474,14 +454,12 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
type = TYPE_INT;
break;
case 'o': case 'u': case 'x': case 'X':
-#if HAVE_LONG_LONG_INT
- /* If 'long long' exists and is larger than 'long': */
+ /* If 'unsigned long long' is larger than 'unsigned long': */
if (flags >= 16 || (flags & 4))
type = TYPE_ULONGLONGINT;
else
-#endif
- /* If 'unsigned long long' exists and is the same as
- 'unsigned long', we parse "llu" into TYPE_ULONGINT. */
+ /* If 'unsigned long long' is the same as 'unsigned long', we
+ parse "llu" into TYPE_ULONGINT. */
if (flags >= 8)
type = TYPE_ULONGINT;
else if (flags & 2)
@@ -534,14 +512,12 @@ PRINTF_PARSE (const CHAR_T *format, DIRECTIVES *d, arguments *a)
type = TYPE_POINTER;
break;
case 'n':
-#if HAVE_LONG_LONG_INT
- /* If 'long long' exists and is larger than 'long': */
+ /* If 'long long' is larger than 'long': */
if (flags >= 16 || (flags & 4))
type = TYPE_COUNT_LONGLONGINT_POINTER;
else
-#endif
- /* If 'long long' exists and is the same as 'long', we parse
- "lln" into TYPE_COUNT_LONGINT_POINTER. */
+ /* If 'long long' is the same as 'long', we parse "lln" into
+ TYPE_COUNT_LONGINT_POINTER. */
if (flags >= 8)
type = TYPE_COUNT_LONGINT_POINTER;
else if (flags & 2)