LCOV - code coverage report
Current view: top level - /ext - skeleton.c (source / functions) Coverage Total Hit
Test: Extension code coverage Lines: 76.2 % 21 16
Test Date: 2025-12-12 05:08:01 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            4 : PHP_FUNCTION(test1)
      20              : {
      21            4 :         ZEND_PARSE_PARAMETERS_NONE();
      22              : 
      23            4 :         php_printf("The extension %s is loaded and working!\r\n", "skeleton");
      24              : }
      25              : 
      26            8 : PHP_FUNCTION(test2)
      27              : {
      28            8 :         char *var = "World";
      29            8 :         size_t var_len = sizeof("World") - 1;
      30              :         zend_string *retval;
      31              : 
      32            8 :         ZEND_PARSE_PARAMETERS_START(0, 1)
      33            8 :                 Z_PARAM_OPTIONAL
      34            8 :                 Z_PARAM_STRING(var, var_len)
      35            8 :         ZEND_PARSE_PARAMETERS_END();
      36              : 
      37            8 :         retval = strpprintf(0, "Hello %s", var);
      38              : 
      39            8 :         RETURN_STR(retval);
      40              : }
      41              : 
      42           28 : PHP_RINIT_FUNCTION(skeleton)
      43              : {
      44              : #if defined(ZTS) && defined(COMPILE_DL_SKELETON)
      45           14 :         ZEND_TSRMLS_CACHE_UPDATE();
      46              : #endif
      47              : 
      48           28 :         return SUCCESS;
      49              : }
      50              : 
      51            0 : PHP_MINFO_FUNCTION(skeleton)
      52              : {
      53            0 :         php_info_print_table_start();
      54            0 :         php_info_print_table_row(2, "skeleton support", "enabled");
      55            0 :         php_info_print_table_end();
      56            0 : }
      57              : 
      58              : zend_module_entry skeleton_module_entry = {
      59              :         STANDARD_MODULE_HEADER,
      60              :         "skeleton",                                   /* Extension name */
      61              :         ext_functions,                                  /* zend_function_entry */
      62              :         NULL,                                                   /* PHP_MINIT - Module initialization */
      63              :         NULL,                                                   /* PHP_MSHUTDOWN - Module shutdown */
      64              :         PHP_RINIT(skeleton),                    /* PHP_RINIT - Request initialization */
      65              :         NULL,                                                   /* PHP_RSHUTDOWN - Request shutdown */
      66              :         PHP_MINFO(skeleton),                    /* PHP_MINFO - Module info */
      67              :         PHP_SKELETON_VERSION,           /* Version */
      68              :         STANDARD_MODULE_PROPERTIES
      69              : };
      70              : 
      71              : #ifdef COMPILE_DL_SKELETON
      72              : # ifdef ZTS
      73              : ZEND_TSRMLS_CACHE_DEFINE()
      74              : # endif
      75           28 : ZEND_GET_MODULE(skeleton)
      76              : #endif
        

Generated by: LCOV version 2.0-1