root/ext/intl/formatter/formatter_data.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. formatter_data_init
  2. formatter_data_free
  3. formatter_data_create

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

/* [<][>][^][v][top][bottom][index][help] */