Deleted Added
full compact
vfprintf.c (302408) vfprintf.c (304890)
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Chris Torek.
7 *
8 * Copyright (c) 2011 The FreeBSD Foundation

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

34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 */
37
38#if defined(LIBC_SCCS) && !defined(lint)
39static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93";
40#endif /* LIBC_SCCS and not lint */
41#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Chris Torek.
7 *
8 * Copyright (c) 2011 The FreeBSD Foundation

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

34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 */
37
38#if defined(LIBC_SCCS) && !defined(lint)
39static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93";
40#endif /* LIBC_SCCS and not lint */
41#include <sys/cdefs.h>
42__FBSDID("$FreeBSD: stable/11/lib/libc/stdio/vfprintf.c 268930 2014-07-20 21:24:29Z pfg $");
42__FBSDID("$FreeBSD: stable/11/lib/libc/stdio/vfprintf.c 304890 2016-08-27 10:00:36Z ache $");
43
44/*
45 * Actual printf innards.
46 *
47 * This code is large and complicated...
48 */
49
50#include "namespace.h"

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

359 struct io_state io; /* I/O buffering state */
360 char buf[BUF]; /* buffer with space for digits of uintmax_t */
361 char ox[2]; /* space for 0x; ox[1] is either x, X, or \0 */
362 union arg *argtable; /* args, built due to positional arg */
363 union arg statargtable [STATIC_ARG_TBL_SIZE];
364 int nextarg; /* 1-based argument index */
365 va_list orgap; /* original argument pointer */
366 char *convbuf; /* wide to multibyte conversion result */
43
44/*
45 * Actual printf innards.
46 *
47 * This code is large and complicated...
48 */
49
50#include "namespace.h"

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

359 struct io_state io; /* I/O buffering state */
360 char buf[BUF]; /* buffer with space for digits of uintmax_t */
361 char ox[2]; /* space for 0x; ox[1] is either x, X, or \0 */
362 union arg *argtable; /* args, built due to positional arg */
363 union arg statargtable [STATIC_ARG_TBL_SIZE];
364 int nextarg; /* 1-based argument index */
365 va_list orgap; /* original argument pointer */
366 char *convbuf; /* wide to multibyte conversion result */
367 int savserr;
367
368 static const char xdigs_lower[16] = "0123456789abcdef";
369 static const char xdigs_upper[16] = "0123456789ABCDEF";
370
371 /* BEWARE, these `goto error' on error. */
372#define PRINT(ptr, len) { \
373 if (io_print(&io, (ptr), (len), locale)) \
374 goto error; \

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

455 return (__xvprintf(fp, fmt0, ap));
456
457 /* sorry, fprintf(read_only_file, "") returns EOF, not 0 */
458 if (prepwrite(fp) != 0) {
459 errno = EBADF;
460 return (EOF);
461 }
462
368
369 static const char xdigs_lower[16] = "0123456789abcdef";
370 static const char xdigs_upper[16] = "0123456789ABCDEF";
371
372 /* BEWARE, these `goto error' on error. */
373#define PRINT(ptr, len) { \
374 if (io_print(&io, (ptr), (len), locale)) \
375 goto error; \

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

456 return (__xvprintf(fp, fmt0, ap));
457
458 /* sorry, fprintf(read_only_file, "") returns EOF, not 0 */
459 if (prepwrite(fp) != 0) {
460 errno = EBADF;
461 return (EOF);
462 }
463
464 savserr = fp->_flags & __SERR;
465 fp->_flags &= ~__SERR;
466
463 convbuf = NULL;
464 fmt = (char *)fmt0;
465 argtable = NULL;
466 nextarg = 1;
467 va_copy(orgap, ap);
468 io_init(&io, fp);
469 ret = 0;
470#ifndef NO_FLOATING_POINT

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

1026#ifndef NO_FLOATING_POINT
1027 if (dtoaresult != NULL)
1028 freedtoa(dtoaresult);
1029#endif
1030 if (convbuf != NULL)
1031 free(convbuf);
1032 if (__sferror(fp))
1033 ret = EOF;
467 convbuf = NULL;
468 fmt = (char *)fmt0;
469 argtable = NULL;
470 nextarg = 1;
471 va_copy(orgap, ap);
472 io_init(&io, fp);
473 ret = 0;
474#ifndef NO_FLOATING_POINT

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

1030#ifndef NO_FLOATING_POINT
1031 if (dtoaresult != NULL)
1032 freedtoa(dtoaresult);
1033#endif
1034 if (convbuf != NULL)
1035 free(convbuf);
1036 if (__sferror(fp))
1037 ret = EOF;
1038 else
1039 fp->_flags |= savserr;
1034 if ((argtable != NULL) && (argtable != statargtable))
1035 free (argtable);
1036 return (ret);
1037 /* NOTREACHED */
1038}
1039
1040 if ((argtable != NULL) && (argtable != statargtable))
1041 free (argtable);
1042 return (ret);
1043 /* NOTREACHED */
1044}
1045