Back to index

php5  5.3.10
formatter_data.c
Go to the documentation of this file.
00001 /*
00002    +----------------------------------------------------------------------+
00003    | PHP Version 5                                                        |
00004    +----------------------------------------------------------------------+
00005    | This source file is subject to version 3.01 of the PHP license,      |
00006    | that is bundled with this package in the file LICENSE, and is        |
00007    | available through the world-wide-web at the following url:           |
00008    | http://www.php.net/license/3_01.txt                                  |
00009    | If you did not receive a copy of the PHP license and are unable to   |
00010    | obtain it through the world-wide-web, please send a note to          |
00011    | license@php.net so we can mail you a copy immediately.               |
00012    +----------------------------------------------------------------------+
00013    | Authors: Stanislav Malyshev <stas@zend.com>                          |
00014    +----------------------------------------------------------------------+
00015  */
00016 
00017 #ifdef HAVE_CONFIG_H
00018 #include "config.h"
00019 #endif
00020 
00021 #include "formatter_data.h"
00022 
00023 /* {{{ void formatter_data_init( formatter_data* nf_data )
00024  * Initialize internals of formatter_data.
00025  */
00026 void formatter_data_init( formatter_data* nf_data TSRMLS_DC )
00027 {
00028        if( !nf_data )
00029               return;
00030 
00031        nf_data->unum                = NULL;
00032        intl_error_reset( &nf_data->error TSRMLS_CC );
00033 }
00034 /* }}} */
00035 
00036 /* {{{ void formatter_data_free( formatter_data* nf_data )
00037  * Clean up mem allocted by internals of formatter_data
00038  */
00039 void formatter_data_free( formatter_data* nf_data TSRMLS_DC )
00040 {
00041        if( !nf_data )
00042               return;
00043 
00044        if( nf_data->unum )
00045               unum_close( nf_data->unum );
00046 
00047        nf_data->unum = NULL;
00048        intl_error_reset( &nf_data->error TSRMLS_CC );
00049 }
00050 /* }}} */
00051 
00052 /* {{{ formatter_data* formatter_data_create()
00053  * Alloc mem for formatter_data and initialize it with default values.
00054  */
00055 formatter_data* formatter_data_create( TSRMLS_D )
00056 {
00057        formatter_data* nf_data = ecalloc( 1, sizeof(formatter_data) );
00058 
00059        formatter_data_init( nf_data TSRMLS_CC );
00060 
00061        return nf_data;
00062 }
00063 /* }}} */
00064 
00065 /*
00066  * Local variables:
00067  * tab-width: 4
00068  * c-basic-offset: 4
00069  * End:
00070  * vim600: noet sw=4 ts=4 fdm=marker
00071  * vim<600: noet sw=4 ts=4
00072  */