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