annotate lib/printf-args.h @ 17282:a4996fb12971

locale: port to Solaris 2.6 and 7 + GNU gettext * lib/locale.in.h: Just include_next <locale.h> when being invoked recursively. This prevents problems on Solaris 2.6 and 7 when combining the localename module with GNU gettext 0.18.2. Problem reported by Tom G. Christensen in <http://lists.gnu.org/archive/html/bug-gnulib/2013-01/msg00084.html>.
author Paul Eggert <eggert@cs.ucla.edu>
date Thu, 10 Jan 2013 13:24:13 -0800
parents e542fd46ad6f
children 344018b6e5d7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Decomposed printf argument list.
17249
e542fd46ad6f maint: update all copyright year number ranges
Eric Blake <eblake@redhat.com>
parents: 16366
diff changeset
2 Copyright (C) 1999, 2002-2003, 2006-2007, 2011-2013 Free Software
12559
c2cbabec01dd update nearly all FSF copyright year lists to include 2010
Jim Meyering <meyering@redhat.com>
parents: 12518
diff changeset
3 Foundation, Inc.
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4
4440
e58a1c05a6ba Update gettext source files from gettext automatically, using srclist-update.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4224
diff changeset
5 This program is free software; you can redistribute it and/or modify
e58a1c05a6ba Update gettext source files from gettext automatically, using srclist-update.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4224
diff changeset
6 it under the terms of the GNU General Public License as published by
e58a1c05a6ba Update gettext source files from gettext automatically, using srclist-update.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4224
diff changeset
7 the Free Software Foundation; either version 2, or (at your option)
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 any later version.
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
4440
e58a1c05a6ba Update gettext source files from gettext automatically, using srclist-update.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4224
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e58a1c05a6ba Update gettext source files from gettext automatically, using srclist-update.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4224
diff changeset
13 GNU General Public License for more details.
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14
4440
e58a1c05a6ba Update gettext source files from gettext automatically, using srclist-update.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4224
diff changeset
15 You should have received a copy of the GNU General Public License along
16366
bb182ee4a09d maint: replace FSF snail-mail addresses with URLs
Paul Eggert <eggert@cs.ucla.edu>
parents: 16201
diff changeset
16 with this program; if not, see <http://www.gnu.org/licenses/>. */
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 #ifndef _PRINTF_ARGS_H
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 #define _PRINTF_ARGS_H
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
8973
7df86a1985e4 Add support for Unicode strings (both as output format and as arguments to
Bruno Haible <bruno@clisp.org>
parents: 8648
diff changeset
21 /* This file can be parametrized with the following macros:
7df86a1985e4 Add support for Unicode strings (both as output format and as arguments to
Bruno Haible <bruno@clisp.org>
parents: 8648
diff changeset
22 ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions.
7df86a1985e4 Add support for Unicode strings (both as output format and as arguments to
Bruno Haible <bruno@clisp.org>
parents: 8648
diff changeset
23 PRINTF_FETCHARGS Name of the function to be declared.
7df86a1985e4 Add support for Unicode strings (both as output format and as arguments to
Bruno Haible <bruno@clisp.org>
parents: 8648
diff changeset
24 STATIC Set to 'static' to declare the function static. */
7df86a1985e4 Add support for Unicode strings (both as output format and as arguments to
Bruno Haible <bruno@clisp.org>
parents: 8648
diff changeset
25
7df86a1985e4 Add support for Unicode strings (both as output format and as arguments to
Bruno Haible <bruno@clisp.org>
parents: 8648
diff changeset
26 /* Default parameters. */
7df86a1985e4 Add support for Unicode strings (both as output format and as arguments to
Bruno Haible <bruno@clisp.org>
parents: 8648
diff changeset
27 #ifndef PRINTF_FETCHARGS
7df86a1985e4 Add support for Unicode strings (both as output format and as arguments to
Bruno Haible <bruno@clisp.org>
parents: 8648
diff changeset
28 # define PRINTF_FETCHARGS printf_fetchargs
7df86a1985e4 Add support for Unicode strings (both as output format and as arguments to
Bruno Haible <bruno@clisp.org>
parents: 8648
diff changeset
29 #endif
7df86a1985e4 Add support for Unicode strings (both as output format and as arguments to
Bruno Haible <bruno@clisp.org>
parents: 8648
diff changeset
30
4872
c5afc99b8ce5 Use xsize.h to protect against memory size overflows.
Bruno Haible <bruno@clisp.org>
parents: 4440
diff changeset
31 /* Get size_t. */
c5afc99b8ce5 Use xsize.h to protect against memory size overflows.
Bruno Haible <bruno@clisp.org>
parents: 4440
diff changeset
32 #include <stddef.h>
c5afc99b8ce5 Use xsize.h to protect against memory size overflows.
Bruno Haible <bruno@clisp.org>
parents: 4440
diff changeset
33
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 /* Get wchar_t. */
8051
9c2b0396b27c Stylistic change: Use '#if HAVE_*' instead of '#ifdef HAVE_*'.
Bruno Haible <bruno@clisp.org>
parents: 7475
diff changeset
35 #if HAVE_WCHAR_T
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 # include <stddef.h>
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 #endif
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 /* Get wint_t. */
8051
9c2b0396b27c Stylistic change: Use '#if HAVE_*' instead of '#ifdef HAVE_*'.
Bruno Haible <bruno@clisp.org>
parents: 7475
diff changeset
40 #if HAVE_WINT_T
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 # include <wchar.h>
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 #endif
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 /* Get va_list. */
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 #include <stdarg.h>
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 /* Argument types */
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49 typedef enum
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 {
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
51 TYPE_NONE,
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
52 TYPE_SCHAR,
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
53 TYPE_UCHAR,
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
54 TYPE_SHORT,
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
55 TYPE_USHORT,
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
56 TYPE_INT,
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
57 TYPE_UINT,
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
58 TYPE_LONGINT,
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
59 TYPE_ULONGINT,
8051
9c2b0396b27c Stylistic change: Use '#if HAVE_*' instead of '#ifdef HAVE_*'.
Bruno Haible <bruno@clisp.org>
parents: 7475
diff changeset
60 #if HAVE_LONG_LONG_INT
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
61 TYPE_LONGLONGINT,
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
62 TYPE_ULONGLONGINT,
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
63 #endif
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
64 TYPE_DOUBLE,
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
65 TYPE_LONGDOUBLE,
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
66 TYPE_CHAR,
8051
9c2b0396b27c Stylistic change: Use '#if HAVE_*' instead of '#ifdef HAVE_*'.
Bruno Haible <bruno@clisp.org>
parents: 7475
diff changeset
67 #if HAVE_WINT_T
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
68 TYPE_WIDE_CHAR,
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
69 #endif
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
70 TYPE_STRING,
8051
9c2b0396b27c Stylistic change: Use '#if HAVE_*' instead of '#ifdef HAVE_*'.
Bruno Haible <bruno@clisp.org>
parents: 7475
diff changeset
71 #if HAVE_WCHAR_T
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
72 TYPE_WIDE_STRING,
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
73 #endif
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
74 TYPE_POINTER,
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
75 TYPE_COUNT_SCHAR_POINTER,
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
76 TYPE_COUNT_SHORT_POINTER,
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
77 TYPE_COUNT_INT_POINTER,
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
78 TYPE_COUNT_LONGINT_POINTER
8051
9c2b0396b27c Stylistic change: Use '#if HAVE_*' instead of '#ifdef HAVE_*'.
Bruno Haible <bruno@clisp.org>
parents: 7475
diff changeset
79 #if HAVE_LONG_LONG_INT
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
80 , TYPE_COUNT_LONGLONGINT_POINTER
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
81 #endif
8973
7df86a1985e4 Add support for Unicode strings (both as output format and as arguments to
Bruno Haible <bruno@clisp.org>
parents: 8648
diff changeset
82 #if ENABLE_UNISTDIO
7df86a1985e4 Add support for Unicode strings (both as output format and as arguments to
Bruno Haible <bruno@clisp.org>
parents: 8648
diff changeset
83 /* The unistdio extensions. */
7df86a1985e4 Add support for Unicode strings (both as output format and as arguments to
Bruno Haible <bruno@clisp.org>
parents: 8648
diff changeset
84 , TYPE_U8_STRING
7df86a1985e4 Add support for Unicode strings (both as output format and as arguments to
Bruno Haible <bruno@clisp.org>
parents: 8648
diff changeset
85 , TYPE_U16_STRING
7df86a1985e4 Add support for Unicode strings (both as output format and as arguments to
Bruno Haible <bruno@clisp.org>
parents: 8648
diff changeset
86 , TYPE_U32_STRING
7df86a1985e4 Add support for Unicode strings (both as output format and as arguments to
Bruno Haible <bruno@clisp.org>
parents: 8648
diff changeset
87 #endif
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
88 } arg_type;
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
89
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
90 /* Polymorphic argument */
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
91 typedef struct
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
92 {
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
93 arg_type type;
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
94 union
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
95 {
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
96 signed char a_schar;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
97 unsigned char a_uchar;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
98 short a_short;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
99 unsigned short a_ushort;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
100 int a_int;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
101 unsigned int a_uint;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
102 long int a_longint;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
103 unsigned long int a_ulongint;
8051
9c2b0396b27c Stylistic change: Use '#if HAVE_*' instead of '#ifdef HAVE_*'.
Bruno Haible <bruno@clisp.org>
parents: 7475
diff changeset
104 #if HAVE_LONG_LONG_INT
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
105 long long int a_longlongint;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
106 unsigned long long int a_ulonglongint;
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
107 #endif
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
108 float a_float;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
109 double a_double;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
110 long double a_longdouble;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
111 int a_char;
8051
9c2b0396b27c Stylistic change: Use '#if HAVE_*' instead of '#ifdef HAVE_*'.
Bruno Haible <bruno@clisp.org>
parents: 7475
diff changeset
112 #if HAVE_WINT_T
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
113 wint_t a_wide_char;
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
114 #endif
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
115 const char* a_string;
8051
9c2b0396b27c Stylistic change: Use '#if HAVE_*' instead of '#ifdef HAVE_*'.
Bruno Haible <bruno@clisp.org>
parents: 7475
diff changeset
116 #if HAVE_WCHAR_T
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
117 const wchar_t* a_wide_string;
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
118 #endif
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
119 void* a_pointer;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
120 signed char * a_count_schar_pointer;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
121 short * a_count_short_pointer;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
122 int * a_count_int_pointer;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
123 long int * a_count_longint_pointer;
8051
9c2b0396b27c Stylistic change: Use '#if HAVE_*' instead of '#ifdef HAVE_*'.
Bruno Haible <bruno@clisp.org>
parents: 7475
diff changeset
124 #if HAVE_LONG_LONG_INT
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
125 long long int * a_count_longlongint_pointer;
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
126 #endif
8973
7df86a1985e4 Add support for Unicode strings (both as output format and as arguments to
Bruno Haible <bruno@clisp.org>
parents: 8648
diff changeset
127 #if ENABLE_UNISTDIO
7df86a1985e4 Add support for Unicode strings (both as output format and as arguments to
Bruno Haible <bruno@clisp.org>
parents: 8648
diff changeset
128 /* The unistdio extensions. */
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
129 const uint8_t * a_u8_string;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
130 const uint16_t * a_u16_string;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 8973
diff changeset
131 const uint32_t * a_u32_string;
8973
7df86a1985e4 Add support for Unicode strings (both as output format and as arguments to
Bruno Haible <bruno@clisp.org>
parents: 8648
diff changeset
132 #endif
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
133 }
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
134 a;
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
135 }
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
136 argument;
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
137
14260
2113f76f7b44 vasnprintf: Reduce use of malloc for small format strings.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
138 /* Number of directly allocated arguments (no malloc() needed). */
2113f76f7b44 vasnprintf: Reduce use of malloc for small format strings.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
139 #define N_DIRECT_ALLOC_ARGUMENTS 7
2113f76f7b44 vasnprintf: Reduce use of malloc for small format strings.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
140
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
141 typedef struct
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
142 {
4872
c5afc99b8ce5 Use xsize.h to protect against memory size overflows.
Bruno Haible <bruno@clisp.org>
parents: 4440
diff changeset
143 size_t count;
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
144 argument *arg;
14260
2113f76f7b44 vasnprintf: Reduce use of malloc for small format strings.
Bruno Haible <bruno@clisp.org>
parents: 14079
diff changeset
145 argument direct_alloc_arg[N_DIRECT_ALLOC_ARGUMENTS];
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
146 }
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
147 arguments;
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
148
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
149
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
150 /* Fetch the arguments, putting them into a. */
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
151 #ifdef STATIC
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
152 STATIC
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
153 #else
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
154 extern
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
155 #endif
8973
7df86a1985e4 Add support for Unicode strings (both as output format and as arguments to
Bruno Haible <bruno@clisp.org>
parents: 8648
diff changeset
156 int PRINTF_FETCHARGS (va_list args, arguments *a);
4224
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
157
83eabea25586 New modules vasnprintf and vasprintf.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
158 #endif /* _PRINTF_ARGS_H */