dateformat_data.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  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. #include "dateformat_data.h"
  20. /* {{{ void dateformat_data_init( dateformat_data* datef_data )
  21. * Initialize internals of dateformat_data.
  22. */
  23. void dateformat_data_init( dateformat_data* datef_data TSRMLS_DC )
  24. {
  25. if( !datef_data )
  26. return;
  27. datef_data->udatf = NULL;
  28. intl_error_reset( &datef_data->error TSRMLS_CC );
  29. }
  30. /* }}} */
  31. /* {{{ void dateformat_data_free( dateformat_data* datef_data )
  32. * Clean up memory allocated for dateformat_data
  33. */
  34. void dateformat_data_free( dateformat_data* datef_data TSRMLS_DC )
  35. {
  36. if( !datef_data )
  37. return;
  38. if( datef_data->udatf )
  39. udat_close( datef_data->udatf );
  40. datef_data->udatf = NULL;
  41. intl_error_reset( &datef_data->error TSRMLS_CC );
  42. }
  43. /* }}} */
  44. /* {{{ dateformat_data* dateformat_data_create()
  45. * Allocate memory for dateformat_data and initialize it with default values.
  46. */
  47. dateformat_data* dateformat_data_create( TSRMLS_D )
  48. {
  49. dateformat_data* datef_data = ecalloc( 1, sizeof(dateformat_data) );
  50. dateformat_data_init( datef_data TSRMLS_CC );
  51. return datef_data;
  52. }
  53. /* }}} */