]> git.saurik.com Git - apple/libc.git/blame - stdio/FreeBSD/printfcommon.h.patch
Libc-763.11.tar.gz
[apple/libc.git] / stdio / FreeBSD / printfcommon.h.patch
CommitLineData
1f2f436a
A
1--- printfcommon.h.orig 2009-11-12 13:29:57.000000000 -0800
2+++ printfcommon.h 2009-11-12 23:50:26.000000000 -0800
3@@ -79,14 +79,14 @@ io_init(struct io_state *iop, FILE *fp)
4 * remain valid until io_flush() is called.
5 */
6 static inline int
7-io_print(struct io_state *iop, const CHAR * __restrict ptr, int len)
8+io_print(struct io_state *iop, const CHAR * __restrict ptr, int len, locale_t loc)
9 {
10
11 iop->iov[iop->uio.uio_iovcnt].iov_base = (char *)ptr;
12 iop->iov[iop->uio.uio_iovcnt].iov_len = len;
13 iop->uio.uio_resid += len;
14 if (++iop->uio.uio_iovcnt >= NIOV)
15- return (__sprint(iop->fp, &iop->uio));
16+ return (__sprint(iop->fp, loc, &iop->uio));
17 else
18 return (0);
19 }
20@@ -107,13 +107,13 @@ static const CHAR zeroes[PADSIZE] =
21 * or the zeroes array.
22 */
23 static inline int
24-io_pad(struct io_state *iop, int howmany, const CHAR * __restrict with)
25+io_pad(struct io_state *iop, int howmany, const CHAR * __restrict with, locale_t loc)
26 {
27 int n;
28
29 while (howmany > 0) {
30 n = (howmany >= PADSIZE) ? PADSIZE : howmany;
31- if (io_print(iop, with, n))
32+ if (io_print(iop, with, n, loc))
33 return (-1);
34 howmany -= n;
35 }
36@@ -126,7 +126,7 @@ io_pad(struct io_state *iop, int howmany
37 */
38 static inline int
39 io_printandpad(struct io_state *iop, const CHAR *p, const CHAR *ep,
40- int len, const CHAR * __restrict with)
41+ int len, const CHAR * __restrict with, locale_t loc)
42 {
43 int p_len;
44
45@@ -134,19 +134,19 @@ io_printandpad(struct io_state *iop, con
46 if (p_len > len)
47 p_len = len;
48 if (p_len > 0) {
49- if (io_print(iop, p, p_len))
50+ if (io_print(iop, p, p_len, loc))
51 return (-1);
52 } else {
53 p_len = 0;
54 }
55- return (io_pad(iop, len - p_len, with));
56+ return (io_pad(iop, len - p_len, with, loc));
57 }
58
59 static inline int
60-io_flush(struct io_state *iop)
61+io_flush(struct io_state *iop, locale_t loc)
62 {
63
64- return (__sprint(iop->fp, &iop->uio));
65+ return (__sprint(iop->fp, loc, &iop->uio));
66 }
67
68 /*
69@@ -205,7 +205,7 @@ __ultoa(u_long val, CHAR *endp, int base
70 break;
71
72 default: /* oops */
73- abort();
74+ LIBC_ABORT("__ultoa: invalid base=%d", base);
75 }
76 return (cp);
77 }
78@@ -255,7 +255,7 @@ __ujtoa(uintmax_t val, CHAR *endp, int b
79 break;
80
81 default:
82- abort();
83+ LIBC_ABORT("__ujtoa: invalid base=%d", base);
84 }
85 return (cp);
86 }