LTP GCOV extension - code coverage report
Current view: directory - ext/spl - spl_functions.c
Test: PHP Code Coverage
Date: 2007-04-10 Instrumented lines: 55
Code covered: 36.4 % Executed lines: 20
Legend: not executed executed

       1                 : /*
       2                 :    +----------------------------------------------------------------------+
       3                 :    | PHP Version 5                                                        |
       4                 :    +----------------------------------------------------------------------+
       5                 :    | Copyright (c) 1997-2007 The PHP Group                                |
       6                 :    +----------------------------------------------------------------------+
       7                 :    | This source file is subject to version 3.01 of the PHP license,      |
       8                 :    | that is bundled with this package in the file LICENSE, and is        |
       9                 :    | available through the world-wide-web at the following url:           |
      10                 :    | http://www.php.net/license/3_01.txt                                  |
      11                 :    | If you did not receive a copy of the PHP license and are unable to   |
      12                 :    | obtain it through the world-wide-web, please send a note to          |
      13                 :    | license@php.net so we can mail you a copy immediately.               |
      14                 :    +----------------------------------------------------------------------+
      15                 :    | Authors: Marcus Boerger <helly@php.net>                              |
      16                 :    +----------------------------------------------------------------------+
      17                 :  */
      18                 : 
      19                 : /* $Id: spl_functions.c,v 1.28.2.3.2.3 2007/01/01 09:36:07 sebastian Exp $ */
      20                 : 
      21                 : #ifdef HAVE_CONFIG_H
      22                 :         #include "config.h"
      23                 : #endif
      24                 : 
      25                 : #include "php.h"
      26                 : #include "php_ini.h"
      27                 : #include "ext/standard/info.h"
      28                 : #include "php_spl.h"
      29                 : 
      30                 : /* {{{ spl_destroy_class */
      31                 : void spl_destroy_class(zend_class_entry ** ppce)
      32               0 : {                           
      33                 :         SPL_DEBUG(fprintf(stderr, "Destroy(%s): %s\n", (*ppce)->type == ZEND_USER_CLASS ? "user" : "other", (*ppce)->name);)
      34               0 :         destroy_zend_class(ppce);
      35               0 : }
      36                 : /* }}} */
      37                 : 
      38                 : /* {{{ spl_register_interface */
      39                 : void spl_register_interface(zend_class_entry ** ppce, char * class_name, zend_function_entry * functions TSRMLS_DC)
      40            1320 : {
      41                 :         zend_class_entry ce;
      42                 :         
      43            1320 :         INIT_CLASS_ENTRY(ce, class_name, functions);
      44            1320 :         ce.name_length = strlen(class_name);
      45            1320 :         *ppce = zend_register_internal_interface(&ce TSRMLS_CC);
      46            1320 : }
      47                 : /* }}} */
      48                 : 
      49                 : /* {{{ spl_register_std_class */
      50                 : PHPAPI void spl_register_std_class(zend_class_entry ** ppce, char * class_name, void * obj_ctor, zend_function_entry * function_list TSRMLS_DC)
      51            1540 : {
      52                 :         zend_class_entry ce;
      53                 :         
      54            1540 :         INIT_CLASS_ENTRY(ce, class_name, function_list);
      55            1540 :         ce.name_length = strlen(class_name);
      56            1540 :         *ppce = zend_register_internal_class(&ce TSRMLS_CC);
      57                 : 
      58                 :         /* entries changed by initialize */
      59            1540 :         if (obj_ctor) {
      60            1320 :                 (*ppce)->create_object = obj_ctor;
      61                 :         }
      62            1540 : }
      63                 : /* }}} */
      64                 : 
      65                 : /* {{{ spl_register_sub_class */
      66                 : PHPAPI void spl_register_sub_class(zend_class_entry ** ppce, zend_class_entry * parent_ce, char * class_name, void *obj_ctor, zend_function_entry * function_list TSRMLS_DC)
      67            5940 : {
      68                 :         zend_class_entry ce;
      69                 :         
      70            5940 :         INIT_CLASS_ENTRY(ce, class_name, function_list);
      71            5940 :         ce.name_length = strlen(class_name);
      72            5940 :         *ppce = zend_register_internal_class_ex(&ce, parent_ce, NULL TSRMLS_CC);
      73                 : 
      74                 :         /* entries changed by initialize */
      75            5940 :         if (obj_ctor) {
      76            3080 :                 (*ppce)->create_object = obj_ctor;
      77                 :         } else {
      78            2860 :                 (*ppce)->create_object = parent_ce->create_object;
      79                 :         }
      80            5940 : }
      81                 : /* }}} */
      82                 : 
      83                 : /* {{{ spl_register_parent_ce */
      84                 : void spl_register_parent_ce(zend_class_entry * class_entry, zend_class_entry * parent_class TSRMLS_DC)
      85               0 : {
      86               0 :         class_entry->parent = parent_class;
      87               0 : }
      88                 : /* }}} */
      89                 : 
      90                 : /* {{{ spl_register_functions */
      91                 : void spl_register_functions(zend_class_entry * class_entry, zend_function_entry * function_list TSRMLS_DC)
      92               0 : {
      93               0 :         zend_register_functions(class_entry, function_list, &class_entry->function_table, MODULE_PERSISTENT TSRMLS_CC);
      94               0 : }
      95                 : /* }}} */
      96                 : 
      97                 : /* {{{ spl_register_property */
      98                 : void spl_register_property( zend_class_entry * class_entry, char *prop_name, int prop_name_len, int prop_flags TSRMLS_DC)
      99               0 : {
     100               0 :         zend_declare_property_null(class_entry, prop_name, prop_name_len, prop_flags TSRMLS_CC);
     101               0 : }
     102                 : /* }}} */
     103                 : 
     104                 : /* {{{ spl_add_class_name */
     105                 : void spl_add_class_name(zval *list, zend_class_entry * pce, int allow, int ce_flags TSRMLS_DC)
     106               0 : {
     107               0 :         if (!allow || (allow > 0 && pce->ce_flags & ce_flags) || (allow < 0 && !(pce->ce_flags & ce_flags))) {
     108               0 :                 size_t len = strlen(pce->name);
     109                 :                 zval *tmp;
     110                 : 
     111               0 :                 if (zend_hash_find(Z_ARRVAL_P(list), pce->name, len+1, (void*)&tmp) == FAILURE) {
     112               0 :                         MAKE_STD_ZVAL(tmp);
     113               0 :                         ZVAL_STRING(tmp, pce->name, 1);
     114               0 :                         zend_hash_add(Z_ARRVAL_P(list), pce->name, len+1, &tmp, sizeof(zval *), NULL);
     115                 :                 }
     116                 :         }
     117               0 : }
     118                 : /* }}} */
     119                 : 
     120                 : /* {{{ spl_add_interfaces */
     121                 : void spl_add_interfaces(zval *list, zend_class_entry * pce, int allow, int ce_flags TSRMLS_DC)
     122               0 : {
     123                 :         zend_uint num_interfaces;
     124                 : 
     125               0 :         for (num_interfaces = 0; num_interfaces < pce->num_interfaces; num_interfaces++) {
     126               0 :                 spl_add_class_name(list, pce->interfaces[num_interfaces], allow, ce_flags TSRMLS_CC);
     127                 :         }
     128               0 : }
     129                 : /* }}} */
     130                 : 
     131                 : /* {{{ spl_add_classes */
     132                 : int spl_add_classes(zend_class_entry ** ppce, zval *list, int sub, int allow, int ce_flags TSRMLS_DC)
     133               0 : {
     134               0 :         zend_class_entry *pce = *ppce;
     135                 : 
     136               0 :         if (!pce) {
     137               0 :                 return 0;
     138                 :         }
     139               0 :         spl_add_class_name(list, pce, allow, ce_flags TSRMLS_CC);
     140               0 :         if (sub) {
     141               0 :                 spl_add_interfaces(list, pce, allow, ce_flags TSRMLS_CC);
     142               0 :                 while (pce->parent) {
     143               0 :                         pce = pce->parent;
     144               0 :                         spl_add_classes(&pce, list, sub, allow, ce_flags TSRMLS_CC);
     145                 :                 }
     146                 :         }
     147               0 :         return 0;
     148                 : }
     149                 : /* }}} */
     150                 : 
     151                 : /*
     152                 :  * Local variables:
     153                 :  * tab-width: 4
     154                 :  * c-basic-offset: 4
     155                 :  * End:
     156                 :  * vim600: fdm=marker
     157                 :  * vim: noet sw=4 ts=4
     158                 :  */

Generated by: LTP GCOV extension version 1.5