DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New] Link: http://www.fltk.org/str.php?L2194 Version: 1.1.9 Definitely needs docs. However, I don't think this function 'leaks' in the traditional sense. The buffer remains allocated, and is either reused (similar to a static array) or grown on subsequent calls, but the buffer is not lost. I don't believe the intention is for the user to ever call free().. even on a mac, doing so would cause a crash on a subsequent call because the value is expected to still be allocated on the next call so that the buffer can be reused. The buffer is freed/re-grown if the string is larger than the last buffer allocation. It's true there's no provision to free the internal buffer, and possibly a way should be provided should the app care to reclaim that internal buffer after e.g. a particularly large string has been processed. Either a separate fl_xxx_free() function could be made, or the function could handle a NULL passed in as a signal to free the internal buffer, eg: const char *fl_latin1_to_local(const char *t, int n) { if ( t == NULL ) { // caller wants to free internal buffer if ( buf ) { free(buf); } buf = 0; n_buf = 0; return(0); } .. Link: http://www.fltk.org/str.php?L2194 Version: 1.1.9 _______________________________________________ fltk-bugs mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-bugs
