diff options
author | Remi Collet <remi@remirepo.net> | 2024-04-23 12:42:40 +0200 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2024-04-23 12:42:40 +0200 |
commit | b68012a87512a569e3577a094418809f3a062c55 (patch) | |
tree | 4aae105bf06353f7d5d34eeffdf8494b74059efb | |
parent | 0c4a904e26e3caf5614a8441450027a2c9d43b51 (diff) |
test build for upcoming 0.5.0
drop patches merged upstream
-rw-r--r-- | PHPINFO | 4 | ||||
-rw-r--r-- | REFLECTION | 133 | ||||
-rw-r--r-- | hdr_histogram-arginfo.patch | 1151 | ||||
-rw-r--r-- | hdr_histogram-lib0114.patch | 323 | ||||
-rw-r--r-- | php-pecl-hdr-histogram.spec | 64 |
5 files changed, 142 insertions, 1533 deletions
@@ -2,5 +2,5 @@ hdrhistogram hdrhistogram support => enabled -Extension version => 0.4.2 -Library version => 0.11.7 +Extension version => 0.5.0 +Library version => 0.11.8 @@ -1,4 +1,4 @@ -Extension [ <persistent> extension #75 hdrhistogram version 0.4.2 ] { +Extension [ <persistent> extension #75 hdrhistogram version 0.5.0 ] { - Functions { Function [ <internal:hdrhistogram> function hdr_init ] { @@ -8,18 +8,19 @@ Extension [ <persistent> extension #75 hdrhistogram version 0.4.2 ] { Parameter #1 [ <required> int $highest_trackable_value ] Parameter #2 [ <required> int $significant_figures ] } + - Return [ HdrHistogram\Histogram|false ] } Function [ <internal:hdrhistogram> function hdr_get_memory_size ] { - Parameters [1] { - Parameter #0 [ <required> $hdr ] + Parameter #0 [ <required> HdrHistogram\Histogram $hdr ] } - Return [ int ] } Function [ <internal:hdrhistogram> function hdr_record_value ] { - Parameters [2] { - Parameter #0 [ <required> $hdr ] + Parameter #0 [ <required> HdrHistogram\Histogram $hdr ] Parameter #1 [ <required> int $value ] } - Return [ bool ] @@ -27,7 +28,7 @@ Extension [ <persistent> extension #75 hdrhistogram version 0.4.2 ] { Function [ <internal:hdrhistogram> function hdr_record_values ] { - Parameters [3] { - Parameter #0 [ <required> $hdr ] + Parameter #0 [ <required> HdrHistogram\Histogram $hdr ] Parameter #1 [ <required> int $value ] Parameter #2 [ <required> int $count ] } @@ -36,58 +37,58 @@ Extension [ <persistent> extension #75 hdrhistogram version 0.4.2 ] { Function [ <internal:hdrhistogram> function hdr_record_corrected_value ] { - Parameters [3] { - Parameter #0 [ <required> $hdr ] + Parameter #0 [ <required> HdrHistogram\Histogram $hdr ] Parameter #1 [ <required> int $value ] Parameter #2 [ <required> int $expected_interval ] } - - Return [ void ] + - Return [ bool ] } Function [ <internal:hdrhistogram> function hdr_mean ] { - Parameters [1] { - Parameter #0 [ <required> $hdr ] + Parameter #0 [ <required> HdrHistogram\Histogram $hdr ] } - - Return [ int ] + - Return [ float ] } Function [ <internal:hdrhistogram> function hdr_stddev ] { - Parameters [1] { - Parameter #0 [ <required> $hdr ] + Parameter #0 [ <required> HdrHistogram\Histogram $hdr ] } - Return [ float ] } Function [ <internal:hdrhistogram> function hdr_min ] { - Parameters [1] { - Parameter #0 [ <required> $hdr ] + Parameter #0 [ <required> HdrHistogram\Histogram $hdr ] } - Return [ int ] } Function [ <internal:hdrhistogram> function hdr_max ] { - Parameters [1] { - Parameter #0 [ <required> $hdr ] + Parameter #0 [ <required> HdrHistogram\Histogram $hdr ] } - Return [ int ] } Function [ <internal:hdrhistogram> function hdr_total_count ] { - Parameters [1] { - Parameter #0 [ <required> $hdr ] + Parameter #0 [ <required> HdrHistogram\Histogram $hdr ] } - Return [ int ] } Function [ <internal:hdrhistogram> function hdr_reset ] { - Parameters [1] { - Parameter #0 [ <required> $hdr ] + Parameter #0 [ <required> HdrHistogram\Histogram $hdr ] } - Return [ void ] } Function [ <internal:hdrhistogram> function hdr_count_at_value ] { - Parameters [2] { - Parameter #0 [ <required> $hdr ] + Parameter #0 [ <required> HdrHistogram\Histogram $hdr ] Parameter #1 [ <required> int $value ] } - Return [ int ] @@ -95,7 +96,7 @@ Extension [ <persistent> extension #75 hdrhistogram version 0.4.2 ] { Function [ <internal:hdrhistogram> function hdr_value_at_percentile ] { - Parameters [2] { - Parameter #0 [ <required> $hdr ] + Parameter #0 [ <required> HdrHistogram\Histogram $hdr ] Parameter #1 [ <required> float $percentile ] } - Return [ int ] @@ -103,49 +104,52 @@ Extension [ <persistent> extension #75 hdrhistogram version 0.4.2 ] { Function [ <internal:hdrhistogram> function hdr_add ] { - Parameters [2] { - Parameter #0 [ <required> $hdr1 ] - Parameter #1 [ <required> $hdr2 ] + Parameter #0 [ <required> HdrHistogram\Histogram $hdr1 ] + Parameter #1 [ <required> HdrHistogram\Histogram $hdr2 ] } + - Return [ HdrHistogram\Histogram|false ] } Function [ <internal:hdrhistogram> function hdr_merge_into ] { - Parameters [2] { - Parameter #0 [ <required> $hdr1 ] - Parameter #1 [ <required> $hdr2 ] + Parameter #0 [ <required> HdrHistogram\Histogram $hdr1 ] + Parameter #1 [ <required> HdrHistogram\Histogram $hdr2 ] } - Return [ int ] } Function [ <internal:hdrhistogram> function hdr_iter_init ] { - Parameters [1] { - Parameter #0 [ <required> $hdr ] + Parameter #0 [ <required> HdrHistogram\Histogram $hdr ] } + - Return [ HdrHistogram\Iterator|false ] } Function [ <internal:hdrhistogram> function hdr_iter_next ] { - Parameters [1] { - Parameter #0 [ <required> $hdr ] + Parameter #0 [ <required> HdrHistogram\Iterator $hdr ] } - Return [ array|false ] } Function [ <internal:hdrhistogram> function hdr_percentile_iter_init ] { - Parameters [2] { - Parameter #0 [ <required> $hdr ] + Parameter #0 [ <required> HdrHistogram\Histogram $hdr ] Parameter #1 [ <required> int $ticks_per_half_distance ] } + - Return [ HdrHistogram\Iterator\Percentile|false ] } Function [ <internal:hdrhistogram> function hdr_percentile_iter_next ] { - Parameters [1] { - Parameter #0 [ <required> $hdr ] + Parameter #0 [ <required> HdrHistogram\Iterator\Percentile $hdr ] } - Return [ array|false ] } Function [ <internal:hdrhistogram> function hdr_export ] { - Parameters [1] { - Parameter #0 [ <required> $hdr ] + Parameter #0 [ <required> HdrHistogram\Histogram $hdr ] } - Return [ array ] } @@ -154,11 +158,12 @@ Extension [ <persistent> extension #75 hdrhistogram version 0.4.2 ] { - Parameters [1] { Parameter #0 [ <required> array $import ] } + - Return [ HdrHistogram\Histogram|false ] } Function [ <internal:hdrhistogram> function hdr_base64_encode ] { - Parameters [1] { - Parameter #0 [ <required> $hdr ] + Parameter #0 [ <required> HdrHistogram\Histogram $hdr ] } - Return [ string|false ] } @@ -167,6 +172,84 @@ Extension [ <persistent> extension #75 hdrhistogram version 0.4.2 ] { - Parameters [1] { Parameter #0 [ <required> string $data ] } + - Return [ HdrHistogram\Histogram|false ] + } + } + + - Classes [3] { + Class [ <internal:hdrhistogram> final class HdrHistogram\Histogram ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [1] { + Method [ <internal:hdrhistogram, ctor> public method __construct ] { + + - Parameters [3] { + Parameter #0 [ <required> int $lowestDiscernibleValue ] + Parameter #1 [ <required> int $highestTrackableValue ] + Parameter #2 [ <required> int $significantFigures ] + } + } + } + } + + Class [ <internal:hdrhistogram> final class HdrHistogram\Iterator ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [1] { + Method [ <internal:hdrhistogram, ctor> public method __construct ] { + + - Parameters [1] { + Parameter #0 [ <required> HdrHistogram\Histogram $histogram ] + } + } + } + } + + Class [ <internal:hdrhistogram> final class HdrHistogram\Iterator\Percentile ] { + + - Constants [0] { + } + + - Static properties [0] { + } + + - Static methods [0] { + } + + - Properties [0] { + } + + - Methods [1] { + Method [ <internal:hdrhistogram, ctor> public method __construct ] { + + - Parameters [2] { + Parameter #0 [ <required> HdrHistogram\Histogram $histogram ] + Parameter #1 [ <required> int $ticksPerHalfDistance ] + } + } + } } } } diff --git a/hdr_histogram-arginfo.patch b/hdr_histogram-arginfo.patch deleted file mode 100644 index ac385fb..0000000 --- a/hdr_histogram-arginfo.patch +++ /dev/null @@ -1,1151 +0,0 @@ -From a7ae95182dea6dd7af6c6c571224c4db0b8c0c09 Mon Sep 17 00:00:00 2001 -From: Remi Collet <remi@remirepo.net> -Date: Wed, 9 Dec 2020 14:59:44 +0100 -Subject: [PATCH] add all arginfo and fix PHP 8 compatibility - ---- - hdrhistogram.c | 177 ++++++++++++++----------------- - hdrhistogram.stub.php | 127 ++++++++++++++++++++++ - hdrhistogram_arginfo.h | 149 ++++++++++++++++++++++++++ - hdrhistogram_legacy_arginfo.h | 131 +++++++++++++++++++++++ - package.xml | 6 ++ - tests/hdrhistogram_009.phpt | 4 + - tests/hdrhistogram_009_php8.phpt | 99 +++++++++++++++++ - tests/hdrhistogram_012.phpt | 4 + - tests/hdrhistogram_012_php8.phpt | 40 +++++++ - 9 files changed, 638 insertions(+), 99 deletions(-) - create mode 100644 hdrhistogram.stub.php - create mode 100644 hdrhistogram_arginfo.h - create mode 100644 hdrhistogram_legacy_arginfo.h - create mode 100644 tests/hdrhistogram_009_php8.phpt - create mode 100644 tests/hdrhistogram_012_php8.phpt - -diff --git a/hdrhistogram.c b/hdrhistogram.c -index a411108..ee7545d 100644 ---- a/hdrhistogram.c -+++ b/hdrhistogram.c -@@ -7,6 +7,12 @@ - #include "hdr/hdr_histogram_log.h" - #include "php_hdrhistogram.h" - -+#if PHP_VERSION_ID < 80000 -+#include "hdrhistogram_legacy_arginfo.h" -+#else -+#include "hdrhistogram_arginfo.h" -+#endif -+ - #define PHP_HDRHISTOGRAM_DESCRIPTOR_RES_NAME "hdr_histogram" - - static int le_hdrhistogram_descriptor; -@@ -14,24 +20,24 @@ static int le_hdrhistogram_iter_descriptor; - - #define strsize_t size_t - --static zend_always_inline void hdr_register_hdr_resource(zval *return_value, struct hdr_histogram* hdr TSRMLS_DC) -+static zend_always_inline void hdr_register_hdr_resource(zval *return_value, struct hdr_histogram* hdr) - { - ZVAL_RES(return_value, zend_register_resource(hdr, le_hdrhistogram_descriptor)); - } - --static zend_always_inline void hdr_register_iter_resource(zval *return_value, struct hdr_iter* iter TSRMLS_DC) -+static zend_always_inline void hdr_register_iter_resource(zval *return_value, struct hdr_iter* iter) - { - ZVAL_RES(return_value, zend_register_resource(iter, le_hdrhistogram_iter_descriptor)); - } - --static zend_always_inline struct hdr_histogram* hdr_fetch_resource(zval *res, zval *return_value TSRMLS_DC) -+static zend_always_inline struct hdr_histogram* hdr_fetch_resource(zval *res, zval *return_value) - { - struct hdr_histogram *hdr; - - return (struct hdr_histogram*)zend_fetch_resource(Z_RES_P(res), PHP_HDRHISTOGRAM_DESCRIPTOR_RES_NAME, le_hdrhistogram_descriptor); - } - --static zend_always_inline struct hdr_iter* hdr_fetch_iterator(zval *res, zval *return_value TSRMLS_DC) -+static zend_always_inline struct hdr_iter* hdr_fetch_iterator(zval *res, zval *return_value) - { - struct hdr_iter *iterator; - -@@ -48,37 +54,10 @@ static zend_always_inline zval* hdr_hash_index_find(HashTable *arr, zend_ulong h - return zend_hash_index_find(arr, h); - } - --zend_function_entry hdrhistogram_functions[] = { -- PHP_FE(hdr_init, NULL) -- PHP_FE(hdr_get_memory_size, NULL) -- PHP_FE(hdr_record_value, NULL) -- PHP_FE(hdr_record_values, NULL) -- PHP_FE(hdr_record_corrected_value, NULL) -- PHP_FE(hdr_mean, NULL) -- PHP_FE(hdr_stddev, NULL) -- PHP_FE(hdr_min, NULL) -- PHP_FE(hdr_max, NULL) -- PHP_FE(hdr_total_count, NULL) -- PHP_FE(hdr_reset, NULL) -- PHP_FE(hdr_count_at_value, NULL) -- PHP_FE(hdr_value_at_percentile, NULL) -- PHP_FE(hdr_add, NULL) -- PHP_FE(hdr_merge_into, NULL) -- PHP_FE(hdr_iter_init, NULL) -- PHP_FE(hdr_iter_next, NULL) -- PHP_FE(hdr_percentile_iter_init, NULL) -- PHP_FE(hdr_percentile_iter_next, NULL) -- PHP_FE(hdr_export, NULL) -- PHP_FE(hdr_import, NULL) -- PHP_FE(hdr_base64_encode, NULL) -- PHP_FE(hdr_base64_decode, NULL) -- { NULL, NULL, NULL } --}; -- - zend_module_entry hdrhistogram_module_entry = { - STANDARD_MODULE_HEADER, - "hdrhistogram", -- hdrhistogram_functions, /* List of functions exposed */ -+ ext_functions, /* List of functions exposed */ - PHP_MINIT(hdrhistogram), /* Module init callback */ - PHP_MSHUTDOWN(hdrhistogram), /* Module shutdown callback */ - PHP_RINIT(hdrhistogram), /* Request init callback */ -@@ -92,7 +71,7 @@ zend_module_entry hdrhistogram_module_entry = { - ZEND_GET_MODULE(hdrhistogram) - #endif - --static void php_hdrhistogram_descriptor_dtor(zend_resource *rsrc TSRMLS_DC) -+static void php_hdrhistogram_descriptor_dtor(zend_resource *rsrc) - { - free(rsrc->ptr); - } -@@ -141,9 +120,9 @@ PHP_FUNCTION(hdr_init) - long lowest_trackable_value, highest_trackable_value, significant_figures; - int res; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", - &lowest_trackable_value, &highest_trackable_value, &significant_figures) == FAILURE) { -- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid arguments passed."); -+ php_error_docref(NULL, E_WARNING, "Invalid arguments passed."); - - RETURN_FALSE; - } -@@ -151,9 +130,9 @@ PHP_FUNCTION(hdr_init) - res = hdr_init(lowest_trackable_value, highest_trackable_value, significant_figures, &hdr); - - if (res == 0) { -- hdr_register_hdr_resource(return_value, hdr TSRMLS_CC); -+ hdr_register_hdr_resource(return_value, hdr); - } else if (res == EINVAL) { -- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Lowest trackable value has to be >= 1."); -+ php_error_docref(NULL, E_WARNING, "Lowest trackable value has to be >= 1."); - - RETURN_FALSE; - } else if (res == ENOMEM) { -@@ -166,11 +145,11 @@ PHP_FUNCTION(hdr_get_memory_size) - struct hdr_histogram *hdr; - zval *zhdr; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zhdr) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zhdr) == FAILURE) { - RETURN_FALSE; - } - -- hdr = hdr_fetch_resource(zhdr, return_value TSRMLS_CC); -+ hdr = hdr_fetch_resource(zhdr, return_value); - - RETURN_LONG(hdr_get_memory_size(hdr)); - } -@@ -180,11 +159,11 @@ PHP_FUNCTION(hdr_mean) - struct hdr_histogram *hdr; - zval *zhdr; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zhdr) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zhdr) == FAILURE) { - RETURN_FALSE; - } - -- hdr = hdr_fetch_resource(zhdr, return_value TSRMLS_CC); -+ hdr = hdr_fetch_resource(zhdr, return_value); - - RETURN_LONG(hdr_mean(hdr)); - } -@@ -194,11 +173,11 @@ PHP_FUNCTION(hdr_stddev) - struct hdr_histogram *hdr; - zval *zhdr; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zhdr) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zhdr) == FAILURE) { - RETURN_FALSE; - } - -- hdr = hdr_fetch_resource(zhdr, return_value TSRMLS_CC); -+ hdr = hdr_fetch_resource(zhdr, return_value); - - RETURN_DOUBLE(hdr_stddev(hdr)); - } -@@ -209,11 +188,11 @@ PHP_FUNCTION(hdr_min) - struct hdr_histogram *hdr; - zval *zhdr; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zhdr) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zhdr) == FAILURE) { - RETURN_FALSE; - } - -- hdr = hdr_fetch_resource(zhdr, return_value TSRMLS_CC); -+ hdr = hdr_fetch_resource(zhdr, return_value); - - RETURN_LONG(hdr_min(hdr)); - } -@@ -223,11 +202,11 @@ PHP_FUNCTION(hdr_max) - struct hdr_histogram *hdr; - zval *zhdr; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zhdr) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zhdr) == FAILURE) { - RETURN_FALSE; - } - -- hdr = hdr_fetch_resource(zhdr, return_value TSRMLS_CC); -+ hdr = hdr_fetch_resource(zhdr, return_value); - - RETURN_LONG(hdr_max(hdr)); - } -@@ -237,11 +216,11 @@ PHP_FUNCTION(hdr_total_count) - struct hdr_histogram *hdr; - zval *zhdr; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zhdr) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zhdr) == FAILURE) { - RETURN_FALSE; - } - -- hdr = hdr_fetch_resource(zhdr, return_value TSRMLS_CC); -+ hdr = hdr_fetch_resource(zhdr, return_value); - - RETURN_LONG(hdr->total_count); - } -@@ -252,11 +231,11 @@ PHP_FUNCTION(hdr_record_value) - zval *zhdr; - long value; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zhdr, &value) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &zhdr, &value) == FAILURE) { - RETURN_FALSE; - } - -- hdr = hdr_fetch_resource(zhdr, return_value TSRMLS_CC); -+ hdr = hdr_fetch_resource(zhdr, return_value); - - if (hdr_record_value(hdr, value) == 0) { - RETURN_FALSE; -@@ -272,11 +251,11 @@ PHP_FUNCTION(hdr_record_values) - long value; - long count; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &zhdr, &value, &count) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rll", &zhdr, &value, &count) == FAILURE) { - RETURN_FALSE; - } - -- hdr = hdr_fetch_resource(zhdr, return_value TSRMLS_CC); -+ hdr = hdr_fetch_resource(zhdr, return_value); - - if (hdr_record_values(hdr, value, count) == 0) { - RETURN_FALSE; -@@ -292,11 +271,11 @@ PHP_FUNCTION(hdr_record_corrected_value) - long value; - long expected_interval; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &zhdr, &value, &expected_interval) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rll", &zhdr, &value, &expected_interval) == FAILURE) { - RETURN_FALSE; - } - -- hdr = hdr_fetch_resource(zhdr, return_value TSRMLS_CC); -+ hdr = hdr_fetch_resource(zhdr, return_value); - - hdr_record_corrected_value(hdr, value, expected_interval); - } -@@ -306,11 +285,11 @@ PHP_FUNCTION(hdr_reset) - struct hdr_histogram *hdr; - zval *zhdr; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zhdr) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zhdr) == FAILURE) { - RETURN_FALSE; - } - -- hdr = hdr_fetch_resource(zhdr, return_value TSRMLS_CC); -+ hdr = hdr_fetch_resource(zhdr, return_value); - - hdr_reset(hdr); - } -@@ -321,11 +300,11 @@ PHP_FUNCTION(hdr_count_at_value) - zval *zhdr; - long value; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zhdr, &value) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &zhdr, &value) == FAILURE) { - RETURN_FALSE; - } - -- hdr = hdr_fetch_resource(zhdr, return_value TSRMLS_CC); -+ hdr = hdr_fetch_resource(zhdr, return_value); - - RETURN_LONG(hdr_count_at_value(hdr, value)); - } -@@ -336,11 +315,11 @@ PHP_FUNCTION(hdr_value_at_percentile) - zval *zhdr; - double percentile; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rd", &zhdr, &percentile) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rd", &zhdr, &percentile) == FAILURE) { - RETURN_FALSE; - } - -- hdr = hdr_fetch_resource(zhdr, return_value TSRMLS_CC); -+ hdr = hdr_fetch_resource(zhdr, return_value); - - RETURN_LONG(hdr_value_at_percentile(hdr, percentile)); - } -@@ -351,12 +330,12 @@ PHP_FUNCTION(hdr_add) - zval *a, *b; - int res; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr", &a, &b) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &a, &b) == FAILURE) { - RETURN_FALSE; - } - -- hdra = hdr_fetch_resource(a, return_value TSRMLS_CC); -- hdrb = hdr_fetch_resource(b, return_value TSRMLS_CC); -+ hdra = hdr_fetch_resource(a, return_value); -+ hdrb = hdr_fetch_resource(b, return_value); - - res = hdr_init(hdra->lowest_trackable_value, hdra->highest_trackable_value, hdra->significant_figures, &hdr_new); - -@@ -364,9 +343,9 @@ PHP_FUNCTION(hdr_add) - hdr_add(hdr_new, hdrb); - - if (res == 0) { -- hdr_register_hdr_resource(return_value, hdr_new TSRMLS_CC); -+ hdr_register_hdr_resource(return_value, hdr_new); - } else if (res == EINVAL) { -- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Lowest trackable value has to be >= 1."); -+ php_error_docref(NULL, E_WARNING, "Lowest trackable value has to be >= 1."); - - RETURN_FALSE; - } else if (res == ENOMEM) { -@@ -379,12 +358,12 @@ PHP_FUNCTION(hdr_merge_into) - struct hdr_histogram *hdra, *hdrb; - zval *a, *b; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rr", &a, &b) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rr", &a, &b) == FAILURE) { - RETURN_FALSE; - } - -- hdra = hdr_fetch_resource(a, return_value TSRMLS_CC); -- hdrb = hdr_fetch_resource(b, return_value TSRMLS_CC); -+ hdra = hdr_fetch_resource(a, return_value); -+ hdrb = hdr_fetch_resource(b, return_value); - - RETURN_LONG(hdr_add(hdra, hdrb)); - } -@@ -395,16 +374,16 @@ PHP_FUNCTION(hdr_iter_init) - struct hdr_histogram *hdr; - zval *zhdr; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zhdr) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zhdr) == FAILURE) { - RETURN_FALSE; - } - -- hdr = hdr_fetch_resource(zhdr, return_value TSRMLS_CC); -+ hdr = hdr_fetch_resource(zhdr, return_value); - - iterator = malloc(sizeof(struct hdr_iter)); - hdr_iter_init(iterator, hdr); - -- hdr_register_iter_resource(return_value, iterator TSRMLS_CC); -+ hdr_register_iter_resource(return_value, iterator); - } - - PHP_FUNCTION(hdr_percentile_iter_init) -@@ -414,16 +393,16 @@ PHP_FUNCTION(hdr_percentile_iter_init) - zval *zhdr; - long ticks_per_half_distance; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &zhdr, &ticks_per_half_distance) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &zhdr, &ticks_per_half_distance) == FAILURE) { - RETURN_FALSE; - } - -- hdr = hdr_fetch_resource(zhdr, return_value TSRMLS_CC); -+ hdr = hdr_fetch_resource(zhdr, return_value); - - iterator = malloc(sizeof(struct hdr_iter)); - hdr_iter_percentile_init(iterator, hdr, ticks_per_half_distance); - -- hdr_register_iter_resource(return_value, iterator TSRMLS_CC); -+ hdr_register_iter_resource(return_value, iterator); - } - - PHP_FUNCTION(hdr_iter_next) -@@ -431,11 +410,11 @@ PHP_FUNCTION(hdr_iter_next) - struct hdr_iter *iterator; - zval *zhdr; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zhdr) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zhdr) == FAILURE) { - RETURN_FALSE; - } - -- iterator = hdr_fetch_iterator(zhdr, return_value TSRMLS_CC); -+ iterator = hdr_fetch_iterator(zhdr, return_value); - - if (hdr_iter_next(iterator)) { - array_init(return_value); -@@ -453,11 +432,11 @@ PHP_FUNCTION(hdr_percentile_iter_next) - struct hdr_iter *iterator; - zval *zhdr; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zhdr) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zhdr) == FAILURE) { - RETURN_FALSE; - } - -- iterator = hdr_fetch_iterator(zhdr, return_value TSRMLS_CC); -+ iterator = hdr_fetch_iterator(zhdr, return_value); - - if (hdr_iter_next(iterator)) { - array_init(return_value); -@@ -483,11 +462,11 @@ PHP_FUNCTION(hdr_export) - int found = 0; - long skipped = 0; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zhdr) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zhdr) == FAILURE) { - RETURN_FALSE; - } - -- hdr = hdr_fetch_resource(zhdr, return_value TSRMLS_CC); -+ hdr = hdr_fetch_resource(zhdr, return_value); - - array_init(return_value); - -@@ -531,7 +510,7 @@ PHP_FUNCTION(hdr_import) - int res, count; - zend_ulong i, bucket, skipped; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &import) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &import) == FAILURE) { - RETURN_FALSE; - } - -@@ -542,7 +521,7 @@ PHP_FUNCTION(hdr_import) - } - - if (lowest_trackable_value <= 0) { -- php_error_docref(NULL TSRMLS_CC, E_WARNING, "lowest_trackable_value (ltv) must be >= 1."); -+ php_error_docref(NULL, E_WARNING, "lowest_trackable_value (ltv) must be >= 1."); - RETURN_FALSE; - } - -@@ -553,7 +532,7 @@ PHP_FUNCTION(hdr_import) - } - - if (highest_trackable_value <= 0) { -- php_error_docref(NULL TSRMLS_CC, E_WARNING, "highest_trackable_value (htv) must be >= 1."); -+ php_error_docref(NULL, E_WARNING, "highest_trackable_value (htv) must be >= 1."); - RETURN_FALSE; - } - -@@ -564,7 +543,7 @@ PHP_FUNCTION(hdr_import) - } - - if (significant_figures <= 0 || significant_figures > 3) { -- php_error_docref(NULL TSRMLS_CC, E_WARNING, "significant_figures (sf) must be 1, 2, or 3."); -+ php_error_docref(NULL, E_WARNING, "significant_figures (sf) must be 1, 2, or 3."); - RETURN_FALSE; - } - -@@ -575,7 +554,7 @@ PHP_FUNCTION(hdr_import) - } - - if (skipped < 0 || lowest_trackable_value < 1 || highest_trackable_value < lowest_trackable_value || significant_figures < 1) { -- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid values for ltv, htv, sf or sk keys given."); -+ php_error_docref(NULL, E_WARNING, "Invalid values for ltv, htv, sf or sk keys given."); - RETURN_FALSE; - } - -@@ -587,9 +566,9 @@ PHP_FUNCTION(hdr_import) - res = hdr_init(lowest_trackable_value, highest_trackable_value, significant_figures, &hdr); - - if (res == 0) { -- hdr_register_hdr_resource(return_value, hdr TSRMLS_CC); -+ hdr_register_hdr_resource(return_value, hdr); - } else if (res == EINVAL) { -- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Lowest trackable value has to be >= 1."); -+ php_error_docref(NULL, E_WARNING, "Lowest trackable value has to be >= 1."); - - RETURN_FALSE; - } else if (res == ENOMEM) { -@@ -627,9 +606,9 @@ PHP_FUNCTION(hdr_import) - res = hdr_init(lowest_trackable_value, highest_trackable_value, significant_figures, &hdr); - - if (res == 0) { -- hdr_register_hdr_resource(return_value, hdr TSRMLS_CC); -+ hdr_register_hdr_resource(return_value, hdr); - } else if (res == EINVAL) { -- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Lowest trackable value has to be >= 1."); -+ php_error_docref(NULL, E_WARNING, "Lowest trackable value has to be >= 1."); - - RETURN_FALSE; - } else if (res == ENOMEM) { -@@ -668,9 +647,9 @@ PHP_FUNCTION(hdr_import) - res = hdr_init(lowest_trackable_value, highest_trackable_value, significant_figures, &hdr); - - if (res == 0) { -- hdr_register_hdr_resource(return_value, hdr TSRMLS_CC); -+ hdr_register_hdr_resource(return_value, hdr); - } else if (res == EINVAL) { -- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Lowest trackable value has to be >= 1."); -+ php_error_docref(NULL, E_WARNING, "Lowest trackable value has to be >= 1."); - - RETURN_FALSE; - } else if (res == ENOMEM) { -@@ -694,7 +673,7 @@ PHP_FUNCTION(hdr_import) - hdr->normalizing_index_offset = 0; - hdr->conversion_ratio = 1.0; - } else { -- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Missing counts (c) or bucket (b) key or not arrays."); -+ php_error_docref(NULL, E_WARNING, "Missing counts (c) or bucket (b) key or not arrays."); - RETURN_FALSE; - } - } -@@ -705,14 +684,14 @@ PHP_FUNCTION(hdr_base64_encode) - zval *zhdr; - char *result = NULL; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zhdr) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &zhdr) == FAILURE) { - RETURN_FALSE; - } - -- hdr = hdr_fetch_resource(zhdr, return_value TSRMLS_CC); -+ hdr = hdr_fetch_resource(zhdr, return_value); - - if (hdr_log_encode(hdr, &result) != 0) { -- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot encode histogram"); -+ php_error_docref(NULL, E_WARNING, "Cannot encode histogram"); - - RETURN_FALSE; - } -@@ -726,15 +705,15 @@ PHP_FUNCTION(hdr_base64_decode) - char *data = NULL; - strsize_t data_len; - -- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &data, &data_len) == FAILURE) { -+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &data, &data_len) == FAILURE) { - RETURN_FALSE; - } - - if (hdr_log_decode(&hdr, data, data_len) != 0) { -- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot decode histogram"); -+ php_error_docref(NULL, E_WARNING, "Cannot decode histogram"); - - RETURN_FALSE; - } - -- hdr_register_hdr_resource(return_value, hdr TSRMLS_CC); -+ hdr_register_hdr_resource(return_value, hdr); - } -diff --git a/hdrhistogram.stub.php b/hdrhistogram.stub.php -new file mode 100644 -index 0000000..c919d98 ---- /dev/null -+++ b/hdrhistogram.stub.php -@@ -0,0 +1,127 @@ -+<?php -+ -+/** -+ * @generate-function-entries -+ * @generate-legacy-arginfo -+ */ -+ -+/** -+ * @return resource|false -+ */ -+function hdr_init(int $lowest_trackable_value, int $highest_trackable_value, int $significant_figures) {} -+ -+/** -+ * @param resource $hdr -+ */ -+function hdr_get_memory_size($hdr): int {}; -+ -+/** -+ * @param resource $hdr -+ */ -+function hdr_record_value($hdr, int $value): bool {}; -+ -+/** -+ * @param resource $hdr -+ */ -+function hdr_record_values($hdr, int $value, int $count): bool {}; -+ -+/** -+ * @param resource $hdr -+ */ -+function hdr_record_corrected_value($hdr, int $value, int $expected_interval): void {}; -+ -+/** -+ * @param resource $hdr -+ */ -+function hdr_mean($hdr): int {}; -+ -+/** -+ * @param resource $hdr -+ */ -+function hdr_stddev($hdr): float {}; -+ -+/** -+ * @param resource $hdr -+ */ -+function hdr_min($hdr): int {}; -+ -+/** -+ * @param resource $hdr -+ */ -+function hdr_max($hdr): int {}; -+ -+/** -+ * @param resource $hdr -+ */ -+function hdr_total_count($hdr): int {}; -+ -+/** -+ * @param resource $hdr -+ */ -+function hdr_reset($hdr): void {}; -+ -+/** -+ * @param resource $hdr -+ */ -+function hdr_count_at_value($hdr, int $value): int {}; -+ -+/** -+ * @param resource $hdr -+ */ -+function hdr_value_at_percentile($hdr, float $percentile): int {}; -+ -+/** -+ * @param resource $hdr1 -+ * @param resource $hdr2 -+ * @return resource|false -+ */ -+function hdr_add($hdr1, $hdr2) {}; -+ -+/** -+ * @param resource $hdr1 -+ * @param resource $hdr2 -+ */ -+function hdr_merge_into($hdr1, $hdr2): int {}; -+ -+/** -+ * @param resource $hdr -+ * @return resource|false -+ */ -+function hdr_iter_init($hdr) {}; -+ -+/** -+ * @param resource $hdr -+ */ -+function hdr_iter_next($hdr): false|Array {}; -+ -+/** -+ * @param resource $hdr -+ * @return resource|false -+ */ -+function hdr_percentile_iter_init($hdr, int $ticks_per_half_distance) {}; -+ -+/** -+ * @param resource $hdr -+ */ -+function hdr_percentile_iter_next($hdr): false|Array {}; -+ -+/** -+ * @param resource $hdr -+ */ -+function hdr_export($hdr): Array {}; -+ -+/** -+ * @return resource|false -+ */ -+function hdr_import(Array $import) {}; -+ -+/** -+ * @param resource $hdr -+ */ -+function hdr_base64_encode($hdr): false|string {}; -+ -+/** -+ * @return resource|false -+ */ -+function hdr_base64_decode(string $data) {}; -+ -diff --git a/hdrhistogram_arginfo.h b/hdrhistogram_arginfo.h -new file mode 100644 -index 0000000..40b04f8 ---- /dev/null -+++ b/hdrhistogram_arginfo.h -@@ -0,0 +1,149 @@ -+/* This is a generated file, edit the .stub.php file instead. -+ * Stub hash: 195b1ceef170a9dd44acc536ff6ae157b79648be */ -+ -+ZEND_BEGIN_ARG_INFO_EX(arginfo_hdr_init, 0, 0, 3) -+ ZEND_ARG_TYPE_INFO(0, lowest_trackable_value, IS_LONG, 0) -+ ZEND_ARG_TYPE_INFO(0, highest_trackable_value, IS_LONG, 0) -+ ZEND_ARG_TYPE_INFO(0, significant_figures, IS_LONG, 0) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hdr_get_memory_size, 0, 1, IS_LONG, 0) -+ ZEND_ARG_INFO(0, hdr) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hdr_record_value, 0, 2, _IS_BOOL, 0) -+ ZEND_ARG_INFO(0, hdr) -+ ZEND_ARG_TYPE_INFO(0, value, IS_LONG, 0) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hdr_record_values, 0, 3, _IS_BOOL, 0) -+ ZEND_ARG_INFO(0, hdr) -+ ZEND_ARG_TYPE_INFO(0, value, IS_LONG, 0) -+ ZEND_ARG_TYPE_INFO(0, count, IS_LONG, 0) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hdr_record_corrected_value, 0, 3, IS_VOID, 0) -+ ZEND_ARG_INFO(0, hdr) -+ ZEND_ARG_TYPE_INFO(0, value, IS_LONG, 0) -+ ZEND_ARG_TYPE_INFO(0, expected_interval, IS_LONG, 0) -+ZEND_END_ARG_INFO() -+ -+#define arginfo_hdr_mean arginfo_hdr_get_memory_size -+ -+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hdr_stddev, 0, 1, IS_DOUBLE, 0) -+ ZEND_ARG_INFO(0, hdr) -+ZEND_END_ARG_INFO() -+ -+#define arginfo_hdr_min arginfo_hdr_get_memory_size -+ -+#define arginfo_hdr_max arginfo_hdr_get_memory_size -+ -+#define arginfo_hdr_total_count arginfo_hdr_get_memory_size -+ -+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hdr_reset, 0, 1, IS_VOID, 0) -+ ZEND_ARG_INFO(0, hdr) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hdr_count_at_value, 0, 2, IS_LONG, 0) -+ ZEND_ARG_INFO(0, hdr) -+ ZEND_ARG_TYPE_INFO(0, value, IS_LONG, 0) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hdr_value_at_percentile, 0, 2, IS_LONG, 0) -+ ZEND_ARG_INFO(0, hdr) -+ ZEND_ARG_TYPE_INFO(0, percentile, IS_DOUBLE, 0) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_INFO_EX(arginfo_hdr_add, 0, 0, 2) -+ ZEND_ARG_INFO(0, hdr1) -+ ZEND_ARG_INFO(0, hdr2) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hdr_merge_into, 0, 2, IS_LONG, 0) -+ ZEND_ARG_INFO(0, hdr1) -+ ZEND_ARG_INFO(0, hdr2) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_INFO_EX(arginfo_hdr_iter_init, 0, 0, 1) -+ ZEND_ARG_INFO(0, hdr) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hdr_iter_next, 0, 1, MAY_BE_FALSE|MAY_BE_ARRAY) -+ ZEND_ARG_INFO(0, hdr) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_INFO_EX(arginfo_hdr_percentile_iter_init, 0, 0, 2) -+ ZEND_ARG_INFO(0, hdr) -+ ZEND_ARG_TYPE_INFO(0, ticks_per_half_distance, IS_LONG, 0) -+ZEND_END_ARG_INFO() -+ -+#define arginfo_hdr_percentile_iter_next arginfo_hdr_iter_next -+ -+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hdr_export, 0, 1, IS_ARRAY, 0) -+ ZEND_ARG_INFO(0, hdr) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_INFO_EX(arginfo_hdr_import, 0, 0, 1) -+ ZEND_ARG_TYPE_INFO(0, import, IS_ARRAY, 0) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hdr_base64_encode, 0, 1, MAY_BE_FALSE|MAY_BE_STRING) -+ ZEND_ARG_INFO(0, hdr) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_INFO_EX(arginfo_hdr_base64_decode, 0, 0, 1) -+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0) -+ZEND_END_ARG_INFO() -+ -+ -+ZEND_FUNCTION(hdr_init); -+ZEND_FUNCTION(hdr_get_memory_size); -+ZEND_FUNCTION(hdr_record_value); -+ZEND_FUNCTION(hdr_record_values); -+ZEND_FUNCTION(hdr_record_corrected_value); -+ZEND_FUNCTION(hdr_mean); -+ZEND_FUNCTION(hdr_stddev); -+ZEND_FUNCTION(hdr_min); -+ZEND_FUNCTION(hdr_max); -+ZEND_FUNCTION(hdr_total_count); -+ZEND_FUNCTION(hdr_reset); -+ZEND_FUNCTION(hdr_count_at_value); -+ZEND_FUNCTION(hdr_value_at_percentile); -+ZEND_FUNCTION(hdr_add); -+ZEND_FUNCTION(hdr_merge_into); -+ZEND_FUNCTION(hdr_iter_init); -+ZEND_FUNCTION(hdr_iter_next); -+ZEND_FUNCTION(hdr_percentile_iter_init); -+ZEND_FUNCTION(hdr_percentile_iter_next); -+ZEND_FUNCTION(hdr_export); -+ZEND_FUNCTION(hdr_import); -+ZEND_FUNCTION(hdr_base64_encode); -+ZEND_FUNCTION(hdr_base64_decode); -+ -+ -+static const zend_function_entry ext_functions[] = { -+ ZEND_FE(hdr_init, arginfo_hdr_init) -+ ZEND_FE(hdr_get_memory_size, arginfo_hdr_get_memory_size) -+ ZEND_FE(hdr_record_value, arginfo_hdr_record_value) -+ ZEND_FE(hdr_record_values, arginfo_hdr_record_values) -+ ZEND_FE(hdr_record_corrected_value, arginfo_hdr_record_corrected_value) -+ ZEND_FE(hdr_mean, arginfo_hdr_mean) -+ ZEND_FE(hdr_stddev, arginfo_hdr_stddev) -+ ZEND_FE(hdr_min, arginfo_hdr_min) -+ ZEND_FE(hdr_max, arginfo_hdr_max) -+ ZEND_FE(hdr_total_count, arginfo_hdr_total_count) -+ ZEND_FE(hdr_reset, arginfo_hdr_reset) -+ ZEND_FE(hdr_count_at_value, arginfo_hdr_count_at_value) -+ ZEND_FE(hdr_value_at_percentile, arginfo_hdr_value_at_percentile) -+ ZEND_FE(hdr_add, arginfo_hdr_add) -+ ZEND_FE(hdr_merge_into, arginfo_hdr_merge_into) -+ ZEND_FE(hdr_iter_init, arginfo_hdr_iter_init) -+ ZEND_FE(hdr_iter_next, arginfo_hdr_iter_next) -+ ZEND_FE(hdr_percentile_iter_init, arginfo_hdr_percentile_iter_init) -+ ZEND_FE(hdr_percentile_iter_next, arginfo_hdr_percentile_iter_next) -+ ZEND_FE(hdr_export, arginfo_hdr_export) -+ ZEND_FE(hdr_import, arginfo_hdr_import) -+ ZEND_FE(hdr_base64_encode, arginfo_hdr_base64_encode) -+ ZEND_FE(hdr_base64_decode, arginfo_hdr_base64_decode) -+ ZEND_FE_END -+}; -diff --git a/hdrhistogram_legacy_arginfo.h b/hdrhistogram_legacy_arginfo.h -new file mode 100644 -index 0000000..030cfe4 ---- /dev/null -+++ b/hdrhistogram_legacy_arginfo.h -@@ -0,0 +1,131 @@ -+/* This is a generated file, edit the .stub.php file instead. -+ * Stub hash: 195b1ceef170a9dd44acc536ff6ae157b79648be */ -+ -+ZEND_BEGIN_ARG_INFO_EX(arginfo_hdr_init, 0, 0, 3) -+ ZEND_ARG_INFO(0, lowest_trackable_value) -+ ZEND_ARG_INFO(0, highest_trackable_value) -+ ZEND_ARG_INFO(0, significant_figures) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_INFO_EX(arginfo_hdr_get_memory_size, 0, 0, 1) -+ ZEND_ARG_INFO(0, hdr) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_INFO_EX(arginfo_hdr_record_value, 0, 0, 2) -+ ZEND_ARG_INFO(0, hdr) -+ ZEND_ARG_INFO(0, value) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_INFO_EX(arginfo_hdr_record_values, 0, 0, 3) -+ ZEND_ARG_INFO(0, hdr) -+ ZEND_ARG_INFO(0, value) -+ ZEND_ARG_INFO(0, count) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_INFO_EX(arginfo_hdr_record_corrected_value, 0, 0, 3) -+ ZEND_ARG_INFO(0, hdr) -+ ZEND_ARG_INFO(0, value) -+ ZEND_ARG_INFO(0, expected_interval) -+ZEND_END_ARG_INFO() -+ -+#define arginfo_hdr_mean arginfo_hdr_get_memory_size -+ -+#define arginfo_hdr_stddev arginfo_hdr_get_memory_size -+ -+#define arginfo_hdr_min arginfo_hdr_get_memory_size -+ -+#define arginfo_hdr_max arginfo_hdr_get_memory_size -+ -+#define arginfo_hdr_total_count arginfo_hdr_get_memory_size -+ -+#define arginfo_hdr_reset arginfo_hdr_get_memory_size -+ -+#define arginfo_hdr_count_at_value arginfo_hdr_record_value -+ -+ZEND_BEGIN_ARG_INFO_EX(arginfo_hdr_value_at_percentile, 0, 0, 2) -+ ZEND_ARG_INFO(0, hdr) -+ ZEND_ARG_INFO(0, percentile) -+ZEND_END_ARG_INFO() -+ -+ZEND_BEGIN_ARG_INFO_EX(arginfo_hdr_add, 0, 0, 2) -+ ZEND_ARG_INFO(0, hdr1) -+ ZEND_ARG_INFO(0, hdr2) -+ZEND_END_ARG_INFO() -+ -+#define arginfo_hdr_merge_into arginfo_hdr_add -+ -+#define arginfo_hdr_iter_init arginfo_hdr_get_memory_size -+ -+#define arginfo_hdr_iter_next arginfo_hdr_get_memory_size -+ -+ZEND_BEGIN_ARG_INFO_EX(arginfo_hdr_percentile_iter_init, 0, 0, 2) -+ ZEND_ARG_INFO(0, hdr) -+ ZEND_ARG_INFO(0, ticks_per_half_distance) -+ZEND_END_ARG_INFO() -+ -+#define arginfo_hdr_percentile_iter_next arginfo_hdr_get_memory_size -+ -+#define arginfo_hdr_export arginfo_hdr_get_memory_size -+ -+ZEND_BEGIN_ARG_INFO_EX(arginfo_hdr_import, 0, 0, 1) -+ ZEND_ARG_INFO(0, import) -+ZEND_END_ARG_INFO() -+ -+#define arginfo_hdr_base64_encode arginfo_hdr_get_memory_size -+ -+ZEND_BEGIN_ARG_INFO_EX(arginfo_hdr_base64_decode, 0, 0, 1) -+ ZEND_ARG_INFO(0, data) -+ZEND_END_ARG_INFO() -+ -+ -+ZEND_FUNCTION(hdr_init); -+ZEND_FUNCTION(hdr_get_memory_size); -+ZEND_FUNCTION(hdr_record_value); -+ZEND_FUNCTION(hdr_record_values); -+ZEND_FUNCTION(hdr_record_corrected_value); -+ZEND_FUNCTION(hdr_mean); -+ZEND_FUNCTION(hdr_stddev); -+ZEND_FUNCTION(hdr_min); -+ZEND_FUNCTION(hdr_max); -+ZEND_FUNCTION(hdr_total_count); -+ZEND_FUNCTION(hdr_reset); -+ZEND_FUNCTION(hdr_count_at_value); -+ZEND_FUNCTION(hdr_value_at_percentile); -+ZEND_FUNCTION(hdr_add); -+ZEND_FUNCTION(hdr_merge_into); -+ZEND_FUNCTION(hdr_iter_init); -+ZEND_FUNCTION(hdr_iter_next); -+ZEND_FUNCTION(hdr_percentile_iter_init); -+ZEND_FUNCTION(hdr_percentile_iter_next); -+ZEND_FUNCTION(hdr_export); -+ZEND_FUNCTION(hdr_import); -+ZEND_FUNCTION(hdr_base64_encode); -+ZEND_FUNCTION(hdr_base64_decode); -+ -+ -+static const zend_function_entry ext_functions[] = { -+ ZEND_FE(hdr_init, arginfo_hdr_init) -+ ZEND_FE(hdr_get_memory_size, arginfo_hdr_get_memory_size) -+ ZEND_FE(hdr_record_value, arginfo_hdr_record_value) -+ ZEND_FE(hdr_record_values, arginfo_hdr_record_values) -+ ZEND_FE(hdr_record_corrected_value, arginfo_hdr_record_corrected_value) -+ ZEND_FE(hdr_mean, arginfo_hdr_mean) -+ ZEND_FE(hdr_stddev, arginfo_hdr_stddev) -+ ZEND_FE(hdr_min, arginfo_hdr_min) -+ ZEND_FE(hdr_max, arginfo_hdr_max) -+ ZEND_FE(hdr_total_count, arginfo_hdr_total_count) -+ ZEND_FE(hdr_reset, arginfo_hdr_reset) -+ ZEND_FE(hdr_count_at_value, arginfo_hdr_count_at_value) -+ ZEND_FE(hdr_value_at_percentile, arginfo_hdr_value_at_percentile) -+ ZEND_FE(hdr_add, arginfo_hdr_add) -+ ZEND_FE(hdr_merge_into, arginfo_hdr_merge_into) -+ ZEND_FE(hdr_iter_init, arginfo_hdr_iter_init) -+ ZEND_FE(hdr_iter_next, arginfo_hdr_iter_next) -+ ZEND_FE(hdr_percentile_iter_init, arginfo_hdr_percentile_iter_init) -+ ZEND_FE(hdr_percentile_iter_next, arginfo_hdr_percentile_iter_next) -+ ZEND_FE(hdr_export, arginfo_hdr_export) -+ ZEND_FE(hdr_import, arginfo_hdr_import) -+ ZEND_FE(hdr_base64_encode, arginfo_hdr_base64_encode) -+ ZEND_FE(hdr_base64_decode, arginfo_hdr_base64_decode) -+ ZEND_FE_END -+}; -diff --git a/tests/hdrhistogram_009_php8.phpt b/tests/hdrhistogram_009_php8.phpt -new file mode 100644 -index 0000000..88af935 ---- /dev/null -+++ b/tests/hdrhistogram_009_php8.phpt -@@ -0,0 +1,99 @@ -+--TEST-- -+hdrhistogram: Base64 Encode/Decode -+--SKIPIF-- -+<?php -+if (PHP_VERSION_ID < 80000) die("skip PHP 8 only"); -+?> -+--FILE-- -+<?php -+ -+$a = hdr_init(1, 100, 1); -+ -+for ($i = 0; $i < 100; $i++) { -+ hdr_record_values($a, $i, 1); -+} -+ -+$data = hdr_base64_encode($a); -+$hdr = hdr_base64_decode($data); -+ -+$iterator = hdr_iter_init($hdr); -+$total = 0; -+while ($data = hdr_iter_next($iterator)) { -+ if ($data['count_at_index']) { -+ echo $data['value'] . ': ' . $data['count_at_index'] . "\n"; -+ $total += $data['count_at_index']; -+ } -+} -+echo "Total: $total\n"; -+ -+try { -+ echo hdr_base64_encode("foo"); -+} catch (TypeError $e) { -+ echo $e->getMessage()."\n"; -+} -+echo hdr_base64_decode("foo"); -+ -+echo hdr_max(hdr_base64_decode(hdr_base64_encode(hdr_init(1, 100, 1)))); -+--EXPECTF-- -+0: 1 -+1: 1 -+2: 1 -+3: 1 -+4: 1 -+5: 1 -+6: 1 -+7: 1 -+8: 1 -+9: 1 -+10: 1 -+11: 1 -+12: 1 -+13: 1 -+14: 1 -+15: 1 -+16: 1 -+17: 1 -+18: 1 -+19: 1 -+20: 1 -+21: 1 -+22: 1 -+23: 1 -+24: 1 -+25: 1 -+26: 1 -+27: 1 -+28: 1 -+29: 1 -+30: 1 -+31: 1 -+32: 2 -+34: 2 -+36: 2 -+38: 2 -+40: 2 -+42: 2 -+44: 2 -+46: 2 -+48: 2 -+50: 2 -+52: 2 -+54: 2 -+56: 2 -+58: 2 -+60: 2 -+62: 2 -+64: 4 -+68: 4 -+72: 4 -+76: 4 -+80: 4 -+84: 4 -+88: 4 -+92: 4 -+96: 4 -+Total: 100 -+hdr_base64_encode(): Argument #1 ($hdr) must be of type resource, string given -+ -+Warning: hdr_base64_decode(): Cannot decode histogram in %s on line %d -+0 -diff --git a/tests/hdrhistogram_012.phpt b/tests/hdrhistogram_012.phpt -index fba4ddf..311cc4c 100644 ---- a/tests/hdrhistogram_012.phpt -+++ b/tests/hdrhistogram_012.phpt -@@ -1,5 +1,9 @@ - --TEST-- - HdrHistogram: hdr_import Error Handling -+--SKIPIF-- -+<?php -+if (PHP_VERSION_ID >= 80000) die("skip PHP < 8 only"); -+?> - --FILE-- - <?php - -diff --git a/tests/hdrhistogram_012_php8.phpt b/tests/hdrhistogram_012_php8.phpt -new file mode 100644 -index 0000000..576b3ed ---- /dev/null -+++ b/tests/hdrhistogram_012_php8.phpt -@@ -0,0 +1,40 @@ -+--TEST-- -+HdrHistogram: hdr_import Error Handling -+--SKIPIF-- -+<?php -+if (PHP_VERSION_ID < 80000) die("skip PHP 8 only"); -+?> -+--FILE-- -+<?php -+ -+$imported = hdr_import(["ltv" => 0, "htv" => 0, "sf" => 0, "sk" => 0, "c" => []]); -+try { -+ $imported = hdr_import(); -+} catch (ArgumentCountError $e) { -+ echo $e->getMessage()."\n"; -+} -+ -+$imported = hdr_import([]); -+$imported = hdr_import(["ltv" => -1]); -+$imported = hdr_import(["ltv" => 1, "htv" => -10]); -+$imported = hdr_import(["ltv" => 1, "htv" => 10, "sf" => -2]); -+$imported = hdr_import(["ltv" => 1, "htv" => 10, "sf" => 1, "c" => null]); -+$imported = hdr_import(["ltv" => 1, "htv" => 10, "sf" => 1, "b" => null]); -+$imported = hdr_import(["ltv" => 1, "htv" => 10, "sf" => 1, "b" => null, "c" => null]); -+--EXPECTF-- -+Warning: hdr_import(): lowest_trackable_value (ltv) must be >= 1. in %s -+hdr_import() expects exactly 1 argument, 0 given -+ -+Warning: hdr_import(): Missing counts (c) or bucket (b) key or not arrays. in %s -+ -+Warning: hdr_import(): lowest_trackable_value (ltv) must be >= 1. in %s -+ -+Warning: hdr_import(): highest_trackable_value (htv) must be >= 1. in %s -+ -+Warning: hdr_import(): significant_figures (sf) must be 1, 2, or 3. in %s -+ -+Warning: hdr_import(): Missing counts (c) or bucket (b) key or not arrays. in %s -+ -+Warning: hdr_import(): Missing counts (c) or bucket (b) key or not arrays. in %s -+ -+Warning: hdr_import(): Missing counts (c) or bucket (b) key or not arrays. in %s diff --git a/hdr_histogram-lib0114.patch b/hdr_histogram-lib0114.patch deleted file mode 100644 index c53ba3a..0000000 --- a/hdr_histogram-lib0114.patch +++ /dev/null @@ -1,323 +0,0 @@ -From b62e02bf30b5967f6b5514dfba025c8c8ce1a431 Mon Sep 17 00:00:00 2001 -From: Remi Collet <remi@remirepo.net> -Date: Tue, 1 Mar 2022 10:31:21 +0100 -Subject: [PATCH 1/3] Fix for libhdr_histogram version 0.11.4 - ---- - config.m4 | 76 ++++++++++++++++++++++++++++++-------------------- - hdrhistogram.c | 34 ++++++++++++++-------- - 2 files changed, 68 insertions(+), 42 deletions(-) - -diff --git a/config.m4 b/config.m4 -index aa4fec8..729a038 100644 ---- a/config.m4 -+++ b/config.m4 -@@ -3,41 +3,57 @@ PHP_ARG_WITH(hdrhistogram, - [ --with-hdrhistogram[=DIR] Enable "hdrhistogram" extension support]) - - if test "$PHP_HDRHISTOGRAM" != "no"; then -- SEARCH_PATH="/usr/local /usr" -- SEARCH_FOR="/include/hdr/hdr_histogram.h" # you most likely want to change this -+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - -- if test -r $PHP_HDRHISTOGRAM/$SEARCH_FOR; then -- HDRHISTOGRAM_PATH=$PHP_HDRHISTOGRAM -+ if test "$PHP_HDRHISTOGRAM" = "yes" -a -x "$PKG_CONFIG" && $PKG_CONFIG --exists hdr_histogram; then -+ -+ AC_MSG_CHECKING([for hdrhistogram from pkg-config]) -+ LIBHDR_CFLAGS=`$PKG_CONFIG hdr_histogram --cflags` -+ LIBHDR_LIBDIR=`$PKG_CONFIG hdr_histogram --libs` -+ LIBHDR_VERSON=`$PKG_CONFIG hdr_histogram --modversion` -+ AC_MSG_RESULT(found $LIBHDR_VERSON) -+ if $PKG_CONFIG hdr_histogram --atleast-version 0.11.4; then -+ AC_DEFINE(HAVE_HDRHISTOGRAM_0_11_4,1,[ ]) -+ fi -+ PHP_EVAL_LIBLINE($LIBHDR_LIBDIR, HDRHISTOGRAM_SHARED_LIBADD) -+ PHP_EVAL_INCLINE($LIBHDR_CFLAGS) - else -- AC_MSG_CHECKING([for hdrhistogram files in default path]) -- for i in $SEARCH_PATH ; do -- if test -r $i/$SEARCH_FOR; then -- HDRHISTOGRAM_PATH=$i -- AC_MSG_RESULT(found in $i) -+ SEARCH_PATH="/usr/local /usr" -+ SEARCH_FOR="/include/hdr/hdr_histogram.h" # you most likely want to change this -+ -+ if test -r $PHP_HDRHISTOGRAM/$SEARCH_FOR; then -+ HDRHISTOGRAM_PATH=$PHP_HDRHISTOGRAM -+ else -+ AC_MSG_CHECKING([for hdrhistogram files in default path]) -+ for i in $SEARCH_PATH ; do -+ if test -r $i/$SEARCH_FOR; then -+ HDRHISTOGRAM_PATH=$i -+ AC_MSG_RESULT(found in $i) -+ fi -+ done - fi -- done -- fi - -- if test -z "$HDRHISTOGRAM_PATH"; then -- AC_MSG_RESULT([not found]) -- AC_MSG_ERROR([Please reinstall the hdrhistogram library]) -- fi -+ if test -z "$HDRHISTOGRAM_PATH"; then -+ AC_MSG_RESULT([not found]) -+ AC_MSG_ERROR([Please reinstall the hdrhistogram library]) -+ fi - -- PHP_ADD_INCLUDE($HDRHISTOGRAM_PATH/include) -- -- LIBNAME=hdr_histogram -- LIBSYMBOL=hdr_init -- -- PHP_CHECK_LIBRARY($LIBNAME, $LIBSYMBOL, -- [ -- PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $HDRHISTOGRAM_PATH/$PHP_LIBDIR, HDRHISTOGRAM_SHARED_LIBADD) -- AC_DEFINE(HAVE_HDRHISTOGRAM,1,[ ]) -- ],[ -- AC_MSG_ERROR([wrong hdrhistogram lib version or lib not found]) -- ],[ -- -L$HDRHISTOGRAM_PATH/$PHP_LIBDIR -- ] -- ) -+ PHP_ADD_INCLUDE($HDRHISTOGRAM_PATH/include) -+ -+ LIBNAME=hdr_histogram -+ LIBSYMBOL=hdr_init -+ -+ PHP_CHECK_LIBRARY($LIBNAME, $LIBSYMBOL, -+ [ -+ PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $HDRHISTOGRAM_PATH/$PHP_LIBDIR, HDRHISTOGRAM_SHARED_LIBADD) -+ AC_DEFINE(HAVE_HDRHISTOGRAM,1,[ ]) -+ ],[ -+ AC_MSG_ERROR([wrong hdrhistogram lib version or lib not found]) -+ ],[ -+ -L$HDRHISTOGRAM_PATH/$PHP_LIBDIR -+ ] -+ ) -+ fi - - PHP_SUBST(HDRHISTOGRAM_SHARED_LIBADD) - -diff --git a/hdrhistogram.c b/hdrhistogram.c -index d3099a1..5a60a53 100644 ---- a/hdrhistogram.c -+++ b/hdrhistogram.c -@@ -117,17 +117,17 @@ PHP_MINFO_FUNCTION(hdrhistogram) - PHP_FUNCTION(hdr_init) - { - struct hdr_histogram *hdr; -- long lowest_trackable_value, highest_trackable_value, significant_figures; -+ long lowest_discernible_value, highest_trackable_value, significant_figures; - int res; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "lll", -- &lowest_trackable_value, &highest_trackable_value, &significant_figures) == FAILURE) { -+ &lowest_discernible_value, &highest_trackable_value, &significant_figures) == FAILURE) { - php_error_docref(NULL, E_WARNING, "Invalid arguments passed."); - - RETURN_FALSE; - } - -- res = hdr_init(lowest_trackable_value, highest_trackable_value, significant_figures, &hdr); -+ res = hdr_init(lowest_discernible_value, highest_trackable_value, significant_figures, &hdr); - - if (res == 0) { - hdr_register_hdr_resource(return_value, hdr); -@@ -342,8 +342,11 @@ PHP_FUNCTION(hdr_add) - hdra = hdr_fetch_resource(a, return_value); - hdrb = hdr_fetch_resource(b, return_value); - -+#ifdef HAVE_HDRHISTOGRAM_0_11_4 -+ res = hdr_init(hdra->lowest_discernible_value, hdra->highest_trackable_value, hdra->significant_figures, &hdr_new); -+#else - res = hdr_init(hdra->lowest_trackable_value, hdra->highest_trackable_value, hdra->significant_figures, &hdr_new); -- -+#endif - hdr_add(hdr_new, hdra); - hdr_add(hdr_new, hdrb); - -@@ -477,9 +480,16 @@ PHP_FUNCTION(hdr_export) - - array_init(return_value); - -+ -+#ifdef HAVE_HDRHISTOGRAM_0_11_4 -+ if (hdr->lowest_discernible_value > 1) { -+ add_assoc_long(return_value, "ltv", hdr->lowest_discernible_value); -+ } -+#else - if (hdr->lowest_trackable_value > 1) { - add_assoc_long(return_value, "ltv", hdr->lowest_trackable_value); - } -+#endif - if (hdr->highest_trackable_value != 60000) { - add_assoc_long(return_value, "htv", hdr->highest_trackable_value); - } -@@ -513,7 +523,7 @@ PHP_FUNCTION(hdr_import) - { - struct hdr_histogram *hdr; - zval *import, *value, *item; -- long lowest_trackable_value, highest_trackable_value, significant_figures; -+ long lowest_discernible_value, highest_trackable_value, significant_figures; - int res, count; - zend_ulong i, bucket, skipped; - -@@ -522,12 +532,12 @@ PHP_FUNCTION(hdr_import) - } - - if (value = hdr_hash_find(Z_ARRVAL_P(import), "ltv", 4)) { -- lowest_trackable_value = Z_LVAL_P(value); -+ lowest_discernible_value = Z_LVAL_P(value); - } else { -- lowest_trackable_value = 1; -+ lowest_discernible_value = 1; - } - -- if (lowest_trackable_value <= 0) { -+ if (lowest_discernible_value <= 0) { - php_error_docref(NULL, E_WARNING, "lowest_trackable_value (ltv) must be >= 1."); - RETURN_FALSE; - } -@@ -560,7 +570,7 @@ PHP_FUNCTION(hdr_import) - skipped = 0; - } - -- if (skipped < 0 || lowest_trackable_value < 1 || highest_trackable_value < lowest_trackable_value || significant_figures < 1) { -+ if (skipped < 0 || lowest_discernible_value < 1 || highest_trackable_value < lowest_discernible_value || significant_figures < 1) { - php_error_docref(NULL, E_WARNING, "Invalid values for ltv, htv, sf or sk keys given."); - RETURN_FALSE; - } -@@ -570,7 +580,7 @@ PHP_FUNCTION(hdr_import) - // version 3 format - if (value != NULL && Z_TYPE_P(value) == IS_ARRAY) { - count = zend_hash_num_elements(Z_ARRVAL_P(value)); -- res = hdr_init(lowest_trackable_value, highest_trackable_value, significant_figures, &hdr); -+ res = hdr_init(lowest_discernible_value, highest_trackable_value, significant_figures, &hdr); - - if (res == 0) { - hdr_register_hdr_resource(return_value, hdr); -@@ -612,7 +622,7 @@ PHP_FUNCTION(hdr_import) - if (value != NULL && Z_TYPE_P(value) == IS_ARRAY) { - count = zend_hash_num_elements(Z_ARRVAL_P(value)); - -- res = hdr_init(lowest_trackable_value, highest_trackable_value, significant_figures, &hdr); -+ res = hdr_init(lowest_discernible_value, highest_trackable_value, significant_figures, &hdr); - - if (res == 0) { - hdr_register_hdr_resource(return_value, hdr); -@@ -655,7 +665,7 @@ PHP_FUNCTION(hdr_import) - - // version 2 format - if (value != NULL && Z_TYPE_P(value) == IS_ARRAY) { -- res = hdr_init(lowest_trackable_value, highest_trackable_value, significant_figures, &hdr); -+ res = hdr_init(lowest_discernible_value, highest_trackable_value, significant_figures, &hdr); - - if (res == 0) { - hdr_register_hdr_resource(return_value, hdr); - -From 82a52859195755097cf3437f957ded89834533c0 Mon Sep 17 00:00:00 2001 -From: Remi Collet <remi@remirepo.net> -Date: Thu, 27 Apr 2023 09:01:20 +0200 -Subject: [PATCH 2/3] improve phpinfo with extension and library version (from - 0.11.7) - ---- - config.m4 | 3 +++ - hdrhistogram.c | 11 +++++++++++ - 2 files changed, 14 insertions(+) - -diff --git a/config.m4 b/config.m4 -index 729a038..955d15c 100644 ---- a/config.m4 -+++ b/config.m4 -@@ -12,6 +12,9 @@ if test "$PHP_HDRHISTOGRAM" != "no"; then - LIBHDR_LIBDIR=`$PKG_CONFIG hdr_histogram --libs` - LIBHDR_VERSON=`$PKG_CONFIG hdr_histogram --modversion` - AC_MSG_RESULT(found $LIBHDR_VERSON) -+ if $PKG_CONFIG hdr_histogram --atleast-version 0.11.7; then -+ AC_DEFINE(HAVE_HDRHISTOGRAM_0_11_7,1,[ ]) -+ fi - if $PKG_CONFIG hdr_histogram --atleast-version 0.11.4; then - AC_DEFINE(HAVE_HDRHISTOGRAM_0_11_4,1,[ ]) - fi -diff --git a/hdrhistogram.c b/hdrhistogram.c -index 5a60a53..fff37db 100644 ---- a/hdrhistogram.c -+++ b/hdrhistogram.c -@@ -3,8 +3,12 @@ - #endif - - #include "php.h" -+#include "ext/standard/info.h" - #include "hdr/hdr_histogram.h" - #include "hdr/hdr_histogram_log.h" -+#ifdef HAVE_HDRHISTOGRAM_0_11_7 -+#include "hdr/hdr_histogram_version.h" -+#endif - #include "php_hdrhistogram.h" - - #if PHP_VERSION_ID < 80000 -@@ -112,6 +116,13 @@ PHP_RSHUTDOWN_FUNCTION(hdrhistogram) - - PHP_MINFO_FUNCTION(hdrhistogram) - { -+ php_info_print_table_start(); -+ -+ php_info_print_table_row(2, "hdrhistogram", "enabled"); -+ php_info_print_table_row(2, "Extension version", HDR_VERSION); -+#ifdef HDR_HISTOGRAM_VERSION -+ php_info_print_table_row(2, "Library version", HDR_HISTOGRAM_VERSION); -+#endif - } - - PHP_FUNCTION(hdr_init) - -From 21e89822c9c98ede68c0a16ece78c3323788888a Mon Sep 17 00:00:00 2001 -From: Remi Collet <remi@remirepo.net> -Date: Thu, 27 Apr 2023 09:03:59 +0200 -Subject: [PATCH 3/3] use normalized macro name - ---- - hdrhistogram.c | 6 +++--- - php_hdrhistogram.h | 2 +- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/hdrhistogram.c b/hdrhistogram.c -index fff37db..0a241be 100644 ---- a/hdrhistogram.c -+++ b/hdrhistogram.c -@@ -67,7 +67,7 @@ zend_module_entry hdrhistogram_module_entry = { - PHP_RINIT(hdrhistogram), /* Request init callback */ - PHP_RSHUTDOWN(hdrhistogram), /* Request shutdown callback */ - PHP_MINFO(hdrhistogram), /* Module info callback */ -- HDR_VERSION, -+ PHP_HDR_HISTOGRAM_VERSION, - STANDARD_MODULE_PROPERTIES - }; - -@@ -118,8 +118,8 @@ PHP_MINFO_FUNCTION(hdrhistogram) - { - php_info_print_table_start(); - -- php_info_print_table_row(2, "hdrhistogram", "enabled"); -- php_info_print_table_row(2, "Extension version", HDR_VERSION); -+ php_info_print_table_row(2, "hdrhistogram support", "enabled"); -+ php_info_print_table_row(2, "Extension version", PHP_HDR_HISTOGRAM_VERSION); - #ifdef HDR_HISTOGRAM_VERSION - php_info_print_table_row(2, "Library version", HDR_HISTOGRAM_VERSION); - #endif -diff --git a/php_hdrhistogram.h b/php_hdrhistogram.h -index 68fd9ae..894b224 100644 ---- a/php_hdrhistogram.h -+++ b/php_hdrhistogram.h -@@ -5,7 +5,7 @@ - - extern zend_module_entry hdrhistogram_module_entry; - #define phpext_hdrhistogram_ptr &hdrhistogram_module_entry --#define HDR_VERSION "0.4.2" -+#define PHP_HDR_HISTOGRAM_VERSION "0.4.2" - - PHP_MINIT_FUNCTION(hdrhistogram); - PHP_MSHUTDOWN_FUNCTION(hdrhistogram); diff --git a/php-pecl-hdr-histogram.spec b/php-pecl-hdr-histogram.spec index b1730d2..3e8b3d5 100644 --- a/php-pecl-hdr-histogram.spec +++ b/php-pecl-hdr-histogram.spec @@ -1,34 +1,32 @@ # remirepo spec file for php-pecl-hdr-histogram # -# Copyright (c) 2016-2023 Remi Collet +# Copyright (c) 2016-2024 Remi Collet # License: CC-BY-SA-4.0 # http://creativecommons.org/licenses/by-sa/4.0/ # # Please, preserve the changelog entries # -%if 0%{?scl:1} -%scl_package php-pecl-hdr-histogram -%endif -%bcond_without tests +%{?scl:%scl_package php-pecl-hdr-histogram} + +%bcond_without tests -%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} -%global proj_name hdr_histogram -%global pecl_name hdrhistogram -%global ini_name 40-%{pecl_name}.ini +%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} +%global proj_name hdr_histogram +%global pecl_name hdrhistogram +%global ini_name 40-%{pecl_name}.ini +%global sources %{proj_name}-%{version} +%global _configure ../%{sources}/configure Summary: PHP extension wrapper for the C hdrhistogram API Name: %{?scl_prefix}php-pecl-hdr-histogram -Version: 0.4.2 -Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} -License: MIT +Version: 0.5.0 +Release: 0%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +License: BSD-2-Clause Group: Development/Languages URL: https://pecl.php.net/package/%{proj_name} -Source: https://pecl.php.net/get/%{proj_name}-%{version}.tgz - -Patch0: %{proj_name}-arginfo.patch -Patch1: %{proj_name}-lib0114.patch +Source: https://pecl.php.net/get/%{sources}.tgz BuildRequires: make BuildRequires: %{?dtsprefix}gcc @@ -40,7 +38,6 @@ BuildRequires: HdrHistogram_c6php-devel >= 0.11.7 Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} -%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} Provides: %{?scl_prefix}php-%{pecl_name} = %{version} Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} @@ -63,17 +60,13 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO %prep %setup -c -q -mv %{proj_name}-%{version} NTS # Remove test file to avoid regsitration sed -e 's/role="test"/role="src"/' \ %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \ -i package.xml -cd NTS -%patch -P0 -p1 -b .pr13 -%patch -P1 -p1 -b .pr15 - +cd %{sources} # Check upstream version (often broken) extver=$(sed -n '/#define PHP_HDR_HISTOGRAM_VERSION/{s/.* "//;s/".*$//;p}' php_hdrhistogram.h) if test "x${extver}" != "x%{version}"; then @@ -87,25 +80,26 @@ cat << 'EOF' | tee %{ini_name} extension=%{pecl_name}.so EOF -cp -pr NTS ZTS +mkdir NTS ZTS %build %{?dtsenable} -cd NTS -%{_bindir}/phpize +cd %{sources} +%{__phpize} + +cd ../NTS %configure \ --with-libdir=%{_lib} \ - --with-php-config=%{_bindir}/php-config + --with-php-config=%{__phpconfig} make %{?_smp_mflags} %if %{with_zts} cd ../ZTS -%{_bindir}/zts-phpize %configure \ --with-libdir=%{_lib} \ - --with-php-config=%{_bindir}/zts-php-config + --with-php-config=%{__ztsphpconfig} make %{?_smp_mflags} %endif @@ -127,14 +121,14 @@ install -Dpm644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} %endif # Documentation -cd NTS +cd %{sources} for i in $(grep 'role="doc"' ../package.xml | sed -e 's/^.*name="//;s/".*$//') do install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{proj_name}/$i done %check -cd NTS +cd %{sources} OPT="-n" [ -f %{php_extdir}/json.so ] && OPT="$OPT -d extension=json.so" @@ -152,7 +146,6 @@ REPORT_EXIT_STATUS=1 \ %endif %if %{with_zts} -cd ../ZTS : Minimal load test for ZTS extension %{__ztsphp} --no-php-ini \ --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ @@ -189,7 +182,7 @@ fi %files -%{?_licensedir:%license NTS/LICENSE} +%{?_licensedir:%license %{sources}/LICENSE} %doc %{pecl_docdir}/%{proj_name} %{pecl_xmldir}/%{name}.xml @@ -203,6 +196,13 @@ fi %changelog +* Tue Apr 23 2024 Remi Collet <remi@remirepo.net> - 0.5.0-0 +- test build for upcoming 0.5.0 +- drop patches merged upstream + +* Fri Sep 1 2023 Remi Collet <remi@remirepo.net> - 0.4.2-4 +- build out of sources tree + * Thu Apr 27 2023 Remi Collet <remi@remirepo.net> - 0.4.2-3 - improved patch for libhdr_histogram 0.11.7 |