]> git.saurik.com Git - apple/libc.git/blob - stdio/FreeBSD/printf-pos.c.patch
Libc-763.13.tar.gz
[apple/libc.git] / stdio / FreeBSD / printf-pos.c.patch
1 --- printf-pos.c.orig 2010-10-25 19:45:24.000000000 -0700
2 +++ printf-pos.c 2010-10-25 19:47:02.000000000 -0700
3 @@ -63,7 +63,10 @@ enum typeid {
4 T_LONG, T_U_LONG, TP_LONG, T_LLONG, T_U_LLONG, TP_LLONG,
5 T_PTRDIFFT, TP_PTRDIFFT, T_SSIZET, T_SIZET, TP_SSIZET,
6 T_INTMAXT, T_UINTMAXT, TP_INTMAXT, TP_VOID, TP_CHAR, TP_SCHAR,
7 - T_DOUBLE, T_LONG_DOUBLE, T_WINT, TP_WCHAR
8 + T_DOUBLE, T_LONG_DOUBLE, T_WINT, TP_WCHAR,
9 +#ifdef VECTORS
10 + T_VECTOR,
11 +#endif
12 };
13
14 /* An expandable array of types. */
15 @@ -240,7 +243,7 @@ addwaster(struct typetable *types, wchar
16 * It will be replaces with a malloc-ed one if it overflows.
17 * Returns 0 on success. On failure, returns nonzero and sets errno.
18 */
19 -int
20 +__private_extern__ int
21 __find_arguments (const char *fmt0, va_list ap, union arg **argtable)
22 {
23 char *fmt; /* format string */
24 @@ -342,7 +345,11 @@ reswitch: switch (ch) {
25 /*FALLTHROUGH*/
26 case 'c':
27 error = addtype(&types,
28 +#ifdef VECTORS
29 + (flags & LONGINT) ? T_WINT : ((flags & VECTOR) ? T_VECTOR : T_INT));
30 +#else
31 (flags & LONGINT) ? T_WINT : T_INT);
32 +#endif
33 if (error)
34 goto error;
35 break;
36 @@ -351,6 +358,12 @@ reswitch: switch (ch) {
37 /*FALLTHROUGH*/
38 case 'd':
39 case 'i':
40 +#ifdef VECTORS
41 + if (flags & VECTOR) {
42 + if ((error = addtype(&types, T_VECTOR)))
43 + goto error;
44 + } else
45 +#endif
46 if ((error = addsarg(&types, flags)))
47 goto error;
48 break;
49 @@ -360,10 +373,15 @@ reswitch: switch (ch) {
50 case 'e':
51 case 'E':
52 case 'f':
53 + case 'F':
54 case 'g':
55 case 'G':
56 error = addtype(&types,
57 +#ifdef VECTORS
58 + (flags & VECTOR) ? T_VECTOR : ((flags & LONGDBL) ? T_LONG_DOUBLE : T_DOUBLE));
59 +#else
60 (flags & LONGDBL) ? T_LONG_DOUBLE : T_DOUBLE);
61 +#endif
62 if (error)
63 goto error;
64 break;
65 @@ -392,11 +410,21 @@ reswitch: switch (ch) {
66 flags |= LONGINT;
67 /*FALLTHROUGH*/
68 case 'o':
69 +#ifdef VECTORS
70 + if (flags & VECTOR) {
71 + if ((error = addtype(&types, T_VECTOR)))
72 + goto error;
73 + } else
74 +#endif
75 if ((error = adduarg(&types, flags)))
76 goto error;
77 break;
78 case 'p':
79 +#ifdef VECTORS
80 + if ((error = addtype(&types, (flags & VECTOR) ? T_VECTOR : TP_VOID)))
81 +#else
82 if ((error = addtype(&types, TP_VOID)))
83 +#endif
84 goto error;
85 break;
86 case 'S':
87 @@ -414,6 +442,12 @@ reswitch: switch (ch) {
88 case 'u':
89 case 'X':
90 case 'x':
91 +#ifdef VECTORS
92 + if (flags & VECTOR) {
93 + if ((error = addtype(&types, T_VECTOR)))
94 + goto error;
95 + } else
96 +#endif
97 if ((error = adduarg(&types, flags)))
98 goto error;
99 break;
100 @@ -431,7 +465,7 @@ error:
101 }
102
103 /* wchar version of __find_arguments. */
104 -int
105 +__private_extern__ int
106 __find_warguments (const wchar_t *fmt0, va_list ap, union arg **argtable)
107 {
108 wchar_t *fmt; /* format string */
109 @@ -551,6 +585,7 @@ reswitch: switch (ch) {
110 case 'e':
111 case 'E':
112 case 'f':
113 + case 'F':
114 case 'g':
115 case 'G':
116 error = addtype(&types,
117 @@ -741,6 +776,11 @@ build_arg_table(struct typetable *types,
118 (*argtable) [n].longdoublearg = va_arg (ap, long double);
119 #endif
120 break;
121 +#ifdef VECTORS
122 + case T_VECTOR:
123 + (*argtable) [n].vectorarg = va_arg (ap, VECTORTYPE);
124 + break;
125 +#endif /* VECTORS */
126 case TP_CHAR:
127 (*argtable) [n].pchararg = va_arg (ap, char *);
128 break;