src/printf.c

changeset 1319
aa1f580f8f59
parent 1318
12fa1d37fe48
equal deleted inserted replaced
1318:12fa1d37fe48 1319:aa1f580f8f59
66 } else if (ret < CX_PRINTF_SBO_SIZE) { 66 } else if (ret < CX_PRINTF_SBO_SIZE) {
67 va_end(ap2); 67 va_end(ap2);
68 return (int) wfc(buf, 1, ret, stream); 68 return (int) wfc(buf, 1, ret, stream);
69 } else { 69 } else {
70 int len = ret + 1; 70 int len = ret + 1;
71 char *newbuf = cxMalloc(cxDefaultAllocator, len); 71 char *newbuf = cxMallocDefault(len);
72 if (!newbuf) { // LCOV_EXCL_START 72 if (!newbuf) { // LCOV_EXCL_START
73 va_end(ap2); 73 va_end(ap2);
74 return -1; 74 return -1;
75 } // LCOV_EXCL_STOP 75 } // LCOV_EXCL_STOP
76 76
77 ret = vsnprintf(newbuf, len, fmt, ap2); 77 ret = vsnprintf(newbuf, len, fmt, ap2);
78 va_end(ap2); 78 va_end(ap2);
79 if (ret > 0) { 79 if (ret > 0) {
80 ret = (int) wfc(newbuf, 1, ret, stream); 80 ret = (int) wfc(newbuf, 1, ret, stream);
81 } 81 }
82 cxFree(cxDefaultAllocator, newbuf); 82 cxFreeDefault(newbuf);
83 } 83 }
84 return ret; 84 return ret;
85 } 85 }
86 86
87 cxmutstr cx_asprintf_a( 87 cxmutstr cx_asprintf_a(

mercurial