90 cxBufferDestroy(&out_line); |
91 cxBufferDestroy(&out_line); |
91 |
92 |
92 return written; |
93 return written; |
93 } |
94 } |
94 |
95 |
95 size_t c2html_bformat( |
96 size_t c2html_textformat( |
96 char const *inputbuffer, |
97 char const *inputbuffer, |
97 size_t inputbuflen, |
|
98 void *outbuf, |
98 void *outbuf, |
99 cx_write_func wfnc, |
99 cx_write_func wfnc, |
100 c2html_highlighter_func highlighter, |
100 c2html_highlighter_func highlighter, |
101 int showln |
101 int showln |
102 ) { |
102 ) { |
103 /* a rough estimate for the number of lines */ |
103 /* a rough estimate for the number of lines */ |
|
104 size_t inputbuflen = strlen(inputbuffer); |
104 size_t est_cap = 16 + inputbuflen / 40; |
105 size_t est_cap = 16 + inputbuflen / 40; |
105 |
106 |
106 /* create the line pointer array */ |
107 /* create the line pointer array */ |
107 CxList *lines = cxArrayListCreateSimple(CX_STORE_POINTERS, est_cap); |
108 CxList *lines = cxArrayListCreateSimple(CX_STORE_POINTERS, est_cap); |
108 cxListAdd(lines, inputbuffer); |
109 cxListAdd(lines, inputbuffer); |