LCOV - code coverage report
Current view: top level - /ext - skeleton.c (source / functions) Coverage Total Hit
Test: Coverage Report Lines: 75.0 % 20 15
Test Date: 2025-09-18 06:36:54 Functions: - 0 0

            Line data    Source code
       1              : /* skeleton extension for PHP */
       2              : 
       3              : #ifdef HAVE_CONFIG_H
       4              : # include <config.h>
       5              : #endif
       6              : 
       7              : #include "php.h"
       8              : #include "ext/standard/info.h"
       9              : #include "php_skeleton.h"
      10              : #include "skeleton_arginfo.h"
      11              : 
      12              : /* For compatibility with older PHP versions */
      13              : #ifndef ZEND_PARSE_PARAMETERS_NONE
      14              : #define ZEND_PARSE_PARAMETERS_NONE() \
      15              :         ZEND_PARSE_PARAMETERS_START(0, 0) \
      16              :         ZEND_PARSE_PARAMETERS_END()
      17              : #endif
      18              : 
      19              : /* {{{ void test1() */
      20            4 : PHP_FUNCTION(test1)
      21              : {
      22            4 :         ZEND_PARSE_PARAMETERS_NONE();
      23              : 
      24            4 :         php_printf("The extension %s is loaded and working!\r\n", "skeleton");
      25              : }
      26              : /* }}} */
      27              : 
      28              : /* {{{ string test2( [ string $var ] ) */
      29            8 : PHP_FUNCTION(test2)
      30              : {
      31            8 :         char *var = "World";
      32            8 :         size_t var_len = sizeof("World") - 1;
      33              :         zend_string *retval;
      34              : 
      35            8 :         ZEND_PARSE_PARAMETERS_START(0, 1)
      36            8 :                 Z_PARAM_OPTIONAL
      37            8 :                 Z_PARAM_STRING(var, var_len)
      38            8 :         ZEND_PARSE_PARAMETERS_END();
      39              : 
      40            8 :         retval = strpprintf(0, "Hello %s", var);
      41              : 
      42            8 :         RETURN_STR(retval);
      43              : }
      44              : /* }}}*/
      45              : 
      46              : /* {{{ PHP_RINIT_FUNCTION */
      47           28 : PHP_RINIT_FUNCTION(skeleton)
      48              : {
      49              : #if defined(ZTS) && defined(COMPILE_DL_SKELETON)
      50              :         ZEND_TSRMLS_CACHE_UPDATE();
      51              : #endif
      52              : 
      53           28 :         return SUCCESS;
      54              : }
      55              : /* }}} */
      56              : 
      57              : /* {{{ PHP_MINFO_FUNCTION */
      58            0 : PHP_MINFO_FUNCTION(skeleton)
      59              : {
      60            0 :         php_info_print_table_start();
      61            0 :         php_info_print_table_row(2, "skeleton support", "enabled");
      62            0 :         php_info_print_table_end();
      63            0 : }
      64              : /* }}} */
      65              : 
      66              : /* {{{ skeleton_module_entry */
      67              : zend_module_entry skeleton_module_entry = {
      68              :         STANDARD_MODULE_HEADER,
      69              :         "skeleton",                                   /* Extension name */
      70              :         ext_functions,                                  /* zend_function_entry */
      71              :         NULL,                                                   /* PHP_MINIT - Module initialization */
      72              :         NULL,                                                   /* PHP_MSHUTDOWN - Module shutdown */
      73              :         PHP_RINIT(skeleton),                    /* PHP_RINIT - Request initialization */
      74              :         NULL,                                                   /* PHP_RSHUTDOWN - Request shutdown */
      75              :         PHP_MINFO(skeleton),                    /* PHP_MINFO - Module info */
      76              :         PHP_SKELETON_VERSION,           /* Version */
      77              :         STANDARD_MODULE_PROPERTIES
      78              : };
      79              : /* }}} */
      80              : 
      81              : #ifdef COMPILE_DL_SKELETON
      82              : # ifdef ZTS
      83              : ZEND_TSRMLS_CACHE_DEFINE()
      84              : # endif
      85           28 : ZEND_GET_MODULE(skeleton)
      86              : #endif
        

Generated by: LCOV version 2.0-1