diff options
author | axel <axel@liljencrantz.se> | 2006-02-10 01:50:20 +1000 |
---|---|---|
committer | axel <axel@liljencrantz.se> | 2006-02-10 01:50:20 +1000 |
commit | d1c9bca2e9f0eaac2fb8e00e5ed07e8e2906bb02 (patch) | |
tree | 9de2b4fd732398afaebd00c732d8fe41762ac322 /translate.c | |
parent | 49973b85dac4baf843b95ae22ffaed7f41ae43bc (diff) |
Another halloc:ification of fish. Halloc has been extended to allow registering function calls, this has allowed the creation of halloc-handled arraylists, stringbuffers, etc. More job parsing halloc-ification has reduced the error handling code to only a shadow of it's former self
darcs-hash:20060209155020-ac50b-e119c5293ce2368e252cfc01b98ab7c629fdd678.gz
Diffstat (limited to 'translate.c')
-rw-r--r-- | translate.c | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/translate.c b/translate.c index c26be6fc..4a109ecd 100644 --- a/translate.c +++ b/translate.c @@ -17,6 +17,7 @@ Translation library, internally uses catgets #include "common.h" #include "util.h" +#include "halloc_util.h" #if HAVE_GETTEXT @@ -45,6 +46,21 @@ static size_t wcs2str_buff_count=0; static int is_init = 0; +static void internal_destroy() +{ + int i; + + if( !is_init ) + return; + + is_init = 0; + + for(i=0; i<BUFF_COUNT; i++ ) + sb_destroy( &buff[i] ); + + free( wcs2str_buff ); +} + static void internal_init() { int i; @@ -52,7 +68,10 @@ static void internal_init() is_init = 1; for(i=0; i<BUFF_COUNT; i++ ) + { sb_init( &buff[i] ); + } + halloc_register_function_void( global_context, &internal_destroy ); bindtextdomain( PACKAGE_NAME, LOCALEDIR ); textdomain( PACKAGE_NAME ); @@ -103,26 +122,6 @@ const wchar_t *wgettext( const wchar_t *in ) return wres; } - -void translate_init() -{ -} - -void translate_destroy() -{ - int i; - - if( !is_init ) - return; - - is_init = 0; - - for(i=0; i<BUFF_COUNT; i++ ) - sb_destroy( &buff[i] ); - - free( wcs2str_buff ); -} - #else const wchar_t *wgettext( const wchar_t *in ) @@ -130,12 +129,4 @@ const wchar_t *wgettext( const wchar_t *in ) return in; } -void translate_init() -{ -} - -void translate_destroy() -{ -} - #endif |