Deleted Added
full compact
vfwprintf.c (302408) vfwprintf.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

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

36 */
37
38#if 0
39#if defined(LIBC_SCCS) && !defined(lint)
40static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93";
41#endif /* LIBC_SCCS and not lint */
42#endif
43#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

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

36 */
37
38#if 0
39#if defined(LIBC_SCCS) && !defined(lint)
40static char sccsid[] = "@(#)vfprintf.c 8.1 (Berkeley) 6/4/93";
41#endif /* LIBC_SCCS and not lint */
42#endif
43#include <sys/cdefs.h>
44__FBSDID("$FreeBSD: stable/11/lib/libc/stdio/vfwprintf.c 268930 2014-07-20 21:24:29Z pfg $");
44__FBSDID("$FreeBSD: stable/11/lib/libc/stdio/vfwprintf.c 304890 2016-08-27 10:00:36Z ache $");
45
46/*
47 * Actual wprintf innards.
48 *
49 * Avoid making gratuitous changes to this source file; it should be kept
50 * as close as possible to vfprintf.c for ease of maintenance.
51 */
52

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

439 struct io_state io; /* I/O buffering state */
440 wchar_t buf[BUF]; /* buffer with space for digits of uintmax_t */
441 wchar_t ox[2]; /* space for 0x hex-prefix */
442 union arg *argtable; /* args, built due to positional arg */
443 union arg statargtable [STATIC_ARG_TBL_SIZE];
444 int nextarg; /* 1-based argument index */
445 va_list orgap; /* original argument pointer */
446 wchar_t *convbuf; /* multibyte to wide conversion result */
45
46/*
47 * Actual wprintf innards.
48 *
49 * Avoid making gratuitous changes to this source file; it should be kept
50 * as close as possible to vfprintf.c for ease of maintenance.
51 */
52

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

439 struct io_state io; /* I/O buffering state */
440 wchar_t buf[BUF]; /* buffer with space for digits of uintmax_t */
441 wchar_t ox[2]; /* space for 0x hex-prefix */
442 union arg *argtable; /* args, built due to positional arg */
443 union arg statargtable [STATIC_ARG_TBL_SIZE];
444 int nextarg; /* 1-based argument index */
445 va_list orgap; /* original argument pointer */
446 wchar_t *convbuf; /* multibyte to wide conversion result */
447 int savserr;
447
448 static const char xdigs_lower[16] = "0123456789abcdef";
449 static const char xdigs_upper[16] = "0123456789ABCDEF";
450
451 /* BEWARE, these `goto error' on error. */
452#define PRINT(ptr, len) do { \
453 if (io_print(&io, (ptr), (len), locale)) \
454 goto error; \

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

531
532
533 /* sorry, fwprintf(read_only_file, L"") returns WEOF, not 0 */
534 if (prepwrite(fp) != 0) {
535 errno = EBADF;
536 return (EOF);
537 }
538
448
449 static const char xdigs_lower[16] = "0123456789abcdef";
450 static const char xdigs_upper[16] = "0123456789ABCDEF";
451
452 /* BEWARE, these `goto error' on error. */
453#define PRINT(ptr, len) do { \
454 if (io_print(&io, (ptr), (len), locale)) \
455 goto error; \

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

532
533
534 /* sorry, fwprintf(read_only_file, L"") returns WEOF, not 0 */
535 if (prepwrite(fp) != 0) {
536 errno = EBADF;
537 return (EOF);
538 }
539
540 savserr = fp->_flags & __SERR;
541 fp->_flags &= ~__SERR;
542
539 convbuf = NULL;
540 fmt = (wchar_t *)fmt0;
541 argtable = NULL;
542 nextarg = 1;
543 va_copy(orgap, ap);
544 io_init(&io, fp);
545 ret = 0;
546#ifndef NO_FLOATING_POINT

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

1091done:
1092 FLUSH();
1093error:
1094 va_end(orgap);
1095 if (convbuf != NULL)
1096 free(convbuf);
1097 if (__sferror(fp))
1098 ret = EOF;
543 convbuf = NULL;
544 fmt = (wchar_t *)fmt0;
545 argtable = NULL;
546 nextarg = 1;
547 va_copy(orgap, ap);
548 io_init(&io, fp);
549 ret = 0;
550#ifndef NO_FLOATING_POINT

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

1095done:
1096 FLUSH();
1097error:
1098 va_end(orgap);
1099 if (convbuf != NULL)
1100 free(convbuf);
1101 if (__sferror(fp))
1102 ret = EOF;
1103 else
1104 fp->_flags |= savserr;
1099 if ((argtable != NULL) && (argtable != statargtable))
1100 free (argtable);
1101 return (ret);
1102 /* NOTREACHED */
1103}
1105 if ((argtable != NULL) && (argtable != statargtable))
1106 free (argtable);
1107 return (ret);
1108 /* NOTREACHED */
1109}