Lines Matching +full:- +full:r
4 * SPDX-License-Identifier: Apache-2.0
10 /* Tiny, but not-as-primitive-as-it-looks implementation of something
14 * the regex: [0-9]*\.?[0-9]*
26 static void pc(struct _pfr *r, int c) in pc() argument
28 if (r->buf != NULL) { in pc()
29 if (r->idx <= r->len) { in pc()
30 r->buf[r->idx] = c; in pc()
35 r->idx++; in pc()
38 static void prdec(struct _pfr *r, long v) in prdec() argument
41 pc(r, '-'); in prdec()
42 v = -v; in prdec()
46 int i = sizeof(digs) - 1; in prdec()
49 --i; in prdec()
52 --i; in prdec()
58 pc(r, digs[i]); in prdec()
63 static void endrec(struct _pfr *r) in endrec() argument
65 if (r->buf && r->idx < r->len) { in endrec()
66 r->buf[r->idx] = 0; in endrec()
70 static int vpf(struct _pfr *r, const char *f, va_list ap) in vpf() argument
76 pc(r, *f); in vpf()
98 return r->idx; in vpf()
100 pc(r, '%'); in vpf()
103 pc(r, va_arg(ap, int)); in vpf()
109 pc(r, *s); in vpf()
115 pc(r, '0'); in vpf()
116 pc(r, 'x'); /* fall through... */ in vpf()
122 for (int i = 2*sizeof(long) - 1; i >= 0; i--) { in vpf()
127 pc(r, "0123456789abcdef"[d]); in vpf()
133 prdec(r, va_arg(ap, int)); in vpf()
136 pc(r, '%'); in vpf()
137 pc(r, *f); in vpf()
140 endrec(r); in vpf()
141 return r->idx; in vpf()
147 ret = vpf(&r, f, ap); \
153 struct _pfr r = { .buf = buf, .len = len }; in snprintf() local
155 CALL_VPF(&r); in snprintf()
162 struct _pfr r = { .buf = buf, .len = 0x7fffffff }; in sprintf() local
164 CALL_VPF(&r); in sprintf()
171 struct _pfr r = {0}; in printf() local
173 CALL_VPF(&r); in printf()