vsprintf.c (2c7d1e30e5884dc6f6727ecd9417491c9f321b59) vsprintf.c (29a2806653360f1ba0f7608ef64d65d441a575f7)
1// SPDX-License-Identifier: GPL-2.0-only
2/* -*- linux-c -*- ------------------------------------------------------- *
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 * Copyright 2007 rPath, Inc. - All Rights Reserved
6 *
7 * ----------------------------------------------------------------------- */
8

--- 113 unchanged lines hidden (view full) ---

122 char *str;
123 const char *s;
124
125 int flags; /* flags to number() */
126
127 int field_width; /* width of output field */
128 int precision; /* min. # of digits for integers; max
129 number of chars for from string */
1// SPDX-License-Identifier: GPL-2.0-only
2/* -*- linux-c -*- ------------------------------------------------------- *
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 * Copyright 2007 rPath, Inc. - All Rights Reserved
6 *
7 * ----------------------------------------------------------------------- */
8

--- 113 unchanged lines hidden (view full) ---

122 char *str;
123 const char *s;
124
125 int flags; /* flags to number() */
126
127 int field_width; /* width of output field */
128 int precision; /* min. # of digits for integers; max
129 number of chars for from string */
130 int qualifier; /* 'h', 'l', or 'L' for integer fields */
130 int qualifier; /* 'h' or 'l' for integer fields */
131
132 for (str = buf; *fmt; ++fmt) {
133 if (*fmt != '%') {
134 *str++ = *fmt;
135 continue;
136 }
137
138 /* process flags */

--- 44 unchanged lines hidden (view full) ---

183 precision = va_arg(args, int);
184 }
185 if (precision < 0)
186 precision = 0;
187 }
188
189 /* get the conversion qualifier */
190 qualifier = -1;
131
132 for (str = buf; *fmt; ++fmt) {
133 if (*fmt != '%') {
134 *str++ = *fmt;
135 continue;
136 }
137
138 /* process flags */

--- 44 unchanged lines hidden (view full) ---

183 precision = va_arg(args, int);
184 }
185 if (precision < 0)
186 precision = 0;
187 }
188
189 /* get the conversion qualifier */
190 qualifier = -1;
191 if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L') {
191 if (*fmt == 'h' || *fmt == 'l') {
192 qualifier = *fmt;
193 ++fmt;
194 }
195
196 /* default base */
197 base = 10;
198
199 switch (*fmt) {

--- 24 unchanged lines hidden (view full) ---

224 field_width = 2 * sizeof(void *);
225 flags |= ZEROPAD;
226 }
227 str = number(str,
228 (unsigned long)va_arg(args, void *), 16,
229 field_width, precision, flags);
230 continue;
231
192 qualifier = *fmt;
193 ++fmt;
194 }
195
196 /* default base */
197 base = 10;
198
199 switch (*fmt) {

--- 24 unchanged lines hidden (view full) ---

224 field_width = 2 * sizeof(void *);
225 flags |= ZEROPAD;
226 }
227 str = number(str,
228 (unsigned long)va_arg(args, void *), 16,
229 field_width, precision, flags);
230 continue;
231
232 case 'n':
233 if (qualifier == 'l') {
234 long *ip = va_arg(args, long *);
235 *ip = (str - buf);
236 } else {
237 int *ip = va_arg(args, int *);
238 *ip = (str - buf);
239 }
240 continue;
241
242 case '%':
243 *str++ = '%';
244 continue;
245
246 /* integer number formats - set up the flags and "break" */
247 case 'o':
248 base = 8;
249 break;

--- 50 unchanged lines hidden ---
232 case '%':
233 *str++ = '%';
234 continue;
235
236 /* integer number formats - set up the flags and "break" */
237 case 'o':
238 base = 8;
239 break;

--- 50 unchanged lines hidden ---