1 /* 2 +----------------------------------------------------------------------+ 3 | This source file is subject to version 3.01 of the PHP license, | 4 | that is bundled with this package in the file LICENSE, and is | 5 | available through the world-wide-web at the following url: | 6 | http://www.php.net/license/3_01.txt | 7 | If you did not receive a copy of the PHP license and are unable to | 8 | obtain it through the world-wide-web, please send a note to | 9 | license@php.net so we can mail you a copy immediately. | 10 +----------------------------------------------------------------------+ 11 | Authors: Stanislav Malyshev <stas@zend.com> | 12 +----------------------------------------------------------------------+ 13 */ 14 15 #ifdef HAVE_CONFIG_H 16 #include "config.h" 17 #endif 18 19 #include "formatter_data.h" 20 21 /* {{{ void formatter_data_init( formatter_data* nf_data ) 22 * Initialize internals of formatter_data. 23 */ formatter_data_init(formatter_data * nf_data)24void formatter_data_init( formatter_data* nf_data ) 25 { 26 if( !nf_data ) 27 return; 28 29 nf_data->unum = NULL; 30 intl_error_reset( &nf_data->error ); 31 } 32 /* }}} */ 33 34 /* {{{ void formatter_data_free( formatter_data* nf_data ) 35 * Clean up mem allocted by internals of formatter_data 36 */ formatter_data_free(formatter_data * nf_data)37void formatter_data_free( formatter_data* nf_data ) 38 { 39 if( !nf_data ) 40 return; 41 42 if( nf_data->unum ) 43 unum_close( nf_data->unum ); 44 45 nf_data->unum = NULL; 46 intl_error_reset( &nf_data->error ); 47 } 48 /* }}} */ 49 50 /* {{{ formatter_data* formatter_data_create() 51 * Alloc mem for formatter_data and initialize it with default values. 52 */ formatter_data_create(void)53formatter_data* formatter_data_create( void ) 54 { 55 formatter_data* nf_data = ecalloc( 1, sizeof(formatter_data) ); 56 57 formatter_data_init( nf_data ); 58 59 return nf_data; 60 } 61 /* }}} */ 62