src/printf.c

changeset 890
54565fd74e74
parent 849
edb9f875b7f9
equal deleted inserted replaced
889:f549fd9fbd8f 890:54565fd74e74
37 unsigned const cx_printf_sbo_size = CX_PRINTF_SBO_SIZE; 37 unsigned const cx_printf_sbo_size = CX_PRINTF_SBO_SIZE;
38 38
39 int cx_fprintf( 39 int cx_fprintf(
40 void *stream, 40 void *stream,
41 cx_write_func wfc, 41 cx_write_func wfc,
42 char const *fmt, 42 const char *fmt,
43 ... 43 ...
44 ) { 44 ) {
45 int ret; 45 int ret;
46 va_list ap; 46 va_list ap;
47 va_start(ap, fmt); 47 va_start(ap, fmt);
51 } 51 }
52 52
53 int cx_vfprintf( 53 int cx_vfprintf(
54 void *stream, 54 void *stream,
55 cx_write_func wfc, 55 cx_write_func wfc,
56 char const *fmt, 56 const char *fmt,
57 va_list ap 57 va_list ap
58 ) { 58 ) {
59 char buf[CX_PRINTF_SBO_SIZE]; 59 char buf[CX_PRINTF_SBO_SIZE];
60 va_list ap2; 60 va_list ap2;
61 va_copy(ap2, ap); 61 va_copy(ap2, ap);
83 } 83 }
84 return ret; 84 return ret;
85 } 85 }
86 86
87 cxmutstr cx_asprintf_a( 87 cxmutstr cx_asprintf_a(
88 CxAllocator const *allocator, 88 const CxAllocator *allocator,
89 char const *fmt, 89 const char *fmt,
90 ... 90 ...
91 ) { 91 ) {
92 va_list ap; 92 va_list ap;
93 va_start(ap, fmt); 93 va_start(ap, fmt);
94 cxmutstr ret = cx_vasprintf_a(allocator, fmt, ap); 94 cxmutstr ret = cx_vasprintf_a(allocator, fmt, ap);
95 va_end(ap); 95 va_end(ap);
96 return ret; 96 return ret;
97 } 97 }
98 98
99 cxmutstr cx_vasprintf_a( 99 cxmutstr cx_vasprintf_a(
100 CxAllocator const *a, 100 const CxAllocator *a,
101 char const *fmt, 101 const char *fmt,
102 va_list ap 102 va_list ap
103 ) { 103 ) {
104 cxmutstr s; 104 cxmutstr s;
105 s.ptr = NULL; 105 s.ptr = NULL;
106 s.length = 0; 106 s.length = 0;

mercurial