PHP  
 PHP: Test and Code Coverage Analysis
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

LTP GCOV extension - code coverage report
Current view: directory - intl/msgformat - msgformat_data.c
Test: PHP Code Coverage
Date: 2009-11-21 Instrumented lines: 31
Code covered: 77.4 % Executed lines: 24
Legend: not executed executed

       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: Stanislav Malyshev <stas@zend.com>                          |
      14                 :    +----------------------------------------------------------------------+
      15                 :  */
      16                 : 
      17                 : #ifdef HAVE_CONFIG_H
      18                 : #include "config.h"
      19                 : #endif
      20                 : 
      21                 : #include <unicode/ustring.h>
      22                 : #include "msgformat_data.h"
      23                 : 
      24                 : /* {{{ void msgformat_data_init( msgformat_data* mf_data )
      25                 :  * Initialize internals of msgformat_data.
      26                 :  */
      27                 : void msgformat_data_init( msgformat_data* mf_data TSRMLS_DC )
      28              78 : {
      29              78 :         if( !mf_data )
      30               0 :                 return;
      31                 : 
      32              78 :         mf_data->umsgf = NULL;
      33              78 :         mf_data->orig_format = NULL;
      34              78 :         intl_error_reset( &mf_data->error TSRMLS_CC );
      35                 : }
      36                 : /* }}} */
      37                 : 
      38                 : /* {{{ void msgformat_data_free( msgformat_data* mf_data )
      39                 :  * Clean up memory allocated for msgformat_data
      40                 :  */
      41                 : void msgformat_data_free( msgformat_data* mf_data TSRMLS_DC )
      42              78 : {
      43              78 :         if( !mf_data )
      44               0 :                 return;
      45                 : 
      46              78 :         if( mf_data->umsgf )
      47              63 :                 umsg_close( mf_data->umsgf );
      48                 : 
      49              78 :         if(mf_data->orig_format) {
      50              46 :                 efree(mf_data->orig_format);
      51              46 :                 mf_data->orig_format = NULL;
      52                 :         }
      53                 : 
      54              78 :         mf_data->umsgf = NULL;
      55              78 :         intl_error_reset( &mf_data->error TSRMLS_CC );
      56                 : }
      57                 : /* }}} */
      58                 : 
      59                 : /* {{{ msgformat_data* msgformat_data_create()
      60                 :  * Allocate memory for msgformat_data and initialize it with default values.
      61                 :  */
      62                 : msgformat_data* msgformat_data_create( TSRMLS_D )
      63               0 : {
      64               0 :         msgformat_data* mf_data = ecalloc( 1, sizeof(msgformat_data) );
      65                 : 
      66               0 :         msgformat_data_init( mf_data TSRMLS_CC );
      67                 : 
      68               0 :         return mf_data;
      69                 : }
      70                 : /* }}} */
      71                 : 
      72                 : int msgformat_fix_quotes(UChar **spattern, uint32_t *spattern_len, UErrorCode *ec) 
      73              70 : {
      74              70 :         if(*spattern && *spattern_len && u_strchr(*spattern, (UChar)'\'')) {
      75               8 :                 UChar *npattern = emalloc(sizeof(UChar)*(2*(*spattern_len)+1));
      76                 :                 uint32_t npattern_len;
      77               8 :                 npattern_len = umsg_autoQuoteApostrophe(*spattern, *spattern_len, npattern, 2*(*spattern_len)+1, ec);
      78               8 :                 efree(*spattern);
      79               8 :                 if( U_FAILURE(*ec) )
      80                 :                 {
      81               0 :                         return FAILURE;
      82                 :                 }
      83               8 :                 npattern = erealloc(npattern, sizeof(UChar)*(npattern_len+1));
      84               8 :                 *spattern = npattern;
      85               8 :                 *spattern_len = npattern_len;
      86                 :         }
      87              70 :         return SUCCESS;
      88                 : }
      89                 : 
      90                 : 
      91                 : /*
      92                 :  * Local variables:
      93                 :  * tab-width: 4
      94                 :  * c-basic-offset: 4
      95                 :  * End:
      96                 :  * vim600: noet sw=4 ts=4 fdm=marker
      97                 :  * vim<600: noet sw=4 ts=4
      98                 :  */

Generated by: LTP GCOV extension version 1.5

Generated at Sat, 21 Nov 2009 12:27:01 +0000 (3 days ago)

Copyright © 2005-2009 The PHP Group
All rights reserved.