diff options
author | 2005-11-03 01:41:59 +1000 | |
---|---|---|
committer | 2005-11-03 01:41:59 +1000 | |
commit | 8d58e58d7bb53e77752ea2897d100398ac62ace7 (patch) | |
tree | c896c3cedbc0bec4230922f442a75473d5007103 /wutil.c | |
parent | c8c3715aac2827c9e8b08ad7a5a56b2d88325d14 (diff) |
Minor performance tweaks
darcs-hash:20051102154159-ac50b-9a32fb6cc654c593048840ebd9f6abb97c2e0bb8.gz
Diffstat (limited to 'wutil.c')
-rw-r--r-- | wutil.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -22,6 +22,8 @@ #include "common.h" #include "wutil.h" +#define TMP_LEN_MIN 256 + /** Buffer for converting wide arguments to narrow arguments, used by the \c wutil_wcs2str() function. @@ -37,6 +39,10 @@ static size_t tmp_len=0; */ static int wutil_calls = 0; +void wutil_init() +{ +} + void wutil_destroy() { free( tmp ); @@ -57,8 +63,8 @@ static char *wutil_wcs2str( const wchar_t *in ) size_t new_sz =MAX_UTF8_BYTES*wcslen(in)+1; if( tmp_len < new_sz ) { - free( tmp ); - tmp = malloc( new_sz ); + new_sz = maxi( new_sz, TMP_LEN_MIN ); + tmp = realloc( tmp, new_sz ); if( !tmp ) { die_mem(); |