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: Kirti Velankar <kirtig@yahoo-inc.com>                       |
14    +----------------------------------------------------------------------+
15 */
16 #ifdef HAVE_CONFIG_H
17 #include "config.h"
18 #endif
19 
20 #include "dateformat_data.h"
21 
22 /* {{{ void dateformat_data_init( dateformat_data* datef_data )
23  * Initialize internals of dateformat_data.
24  */
dateformat_data_init(dateformat_data * datef_data)25 void dateformat_data_init( dateformat_data* datef_data )
26 {
27 	if( !datef_data )
28 		return;
29 
30 	datef_data->udatf = NULL;
31 	intl_error_reset( &datef_data->error );
32 }
33 /* }}} */
34 
35 /* {{{ void dateformat_data_free( dateformat_data* datef_data )
36  * Clean up memory allocated for dateformat_data
37  */
dateformat_data_free(dateformat_data * datef_data)38 void dateformat_data_free( dateformat_data* datef_data )
39 {
40 	if( !datef_data )
41 		return;
42 
43 	if( datef_data->udatf )
44 		udat_close( datef_data->udatf );
45 
46 	datef_data->udatf = NULL;
47 	intl_error_reset( &datef_data->error );
48 }
49 /* }}} */
50 
51 /* {{{ dateformat_data* dateformat_data_create()
52  * Allocate memory for dateformat_data and initialize it with default values.
53  */
dateformat_data_create(void)54 dateformat_data* dateformat_data_create( void )
55 {
56 	dateformat_data* datef_data = ecalloc( 1, sizeof(dateformat_data) );
57 
58 	dateformat_data_init( datef_data );
59 
60 	return datef_data;
61 }
62 /* }}} */
63