8000 Rework how we declare ZSTD min/max constants. · phpredis/phpredis@34b5bd8 · GitHub
[go: up one dir, main page]

Skip to content < 8000 div data-target="react-partial.reactRoot">

Commit 34b5bd8

Browse files
Rework how we declare ZSTD min/max constants.
Fixes #2487
1 parent f865d5b commit 34b5bd8

File tree

3 files changed

+40
-18
lines changed

3 files changed

+40
-18
lines changed

redis.stub.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,22 +239,28 @@ class Redis {
239239
public const COMPRESSION_ZSTD_DEFAULT = 3;
240240
#endif
241241

242-
#ifdef ZSTD_CLEVEL_MAX
242+
#if ZSTD_VERSION_NUMBER >= 10400
243243
/**
244244
*
245245
* @var int
246-
* @cvalue ZSTD_CLEVEL_MAX
246+
* @cvalue ZSTD_minCLevel()
247247
*
248248
*/
249-
public const COMPRESSION_ZSTD_MAX = UNKNOWN;
249+
public const COMPRESSION_ZSTD_MIN = UNKNOWN;
250+
#else
251+
/**
252+
*
253+
* @var int
254+
*
255+
*/
256+
public const COMPRESSION_ZSTD_MIN = 1;
250257
#endif
251258

252259
/**
253260
* @var int
254261
* @cvalue ZSTD_maxCLevel()
255262
*/
256263
public const COMPRESSION_ZSTD_MAX = UNKNOWN;
257-
258264
#endif
259265

260266
#ifdef HAVE_REDIS_LZ4

redis_arginfo.h

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 21f3434814d9fa077a9a81c8ba114c3faf079e85 */
2+
* Stub hash: 04fe88bbcc4d3dc3be06385e8931dfb080442f23 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis___construct, 0, 0, 0)
55
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null")
@@ -1866,13 +1866,21 @@ static zend_class_entry *register_class_Redis(void)
18661866
zend_declare_class_constant_ex(class_entry, const_COMPRESSION_ZSTD_DEFAULT_name, &const_COMPRESSION_ZSTD_DEFAULT_value, ZEND_ACC_PUBLIC, NULL);
18671867
zend_string_release(const_COMPRESSION_ZSTD_DEFAULT_name);
18681868
#endif
1869-
#if defined(HAVE_REDIS_ZSTD) && defined(ZSTD_CLEVEL_MAX)
1869+
#if defined(HAVE_REDIS_ZSTD) && ZSTD_VERSION_NUMBER >= 10400
18701870

1871-
zval const_COMPRESSION_ZSTD_MAX_value;
1872-
ZVAL_LONG(&const_COMPRESSION_ZSTD_MAX_value, ZSTD_CLEVEL_MAX);
1873-
zend_string *const_COMPRESSION_ZSTD_MAX_name = zend_string_init_interned("COMPRESSION_ZSTD_MAX", sizeof("COMPRESSION_ZSTD_MAX") - 1, 1);
1874-
zend_declare_class_constant_ex(class_entry, const_COMPRESSION_ZSTD_MAX_name, &const_COMPRESSION_ZSTD_MAX_value, ZEND_ACC_PUBLIC, NULL);
1875-
zend_string_release(const_COMPRESSION_ZSTD_MAX_name);
1871+
zval const_COMPRESSION_ZSTD_MIN_value;
1872+
ZVAL_LONG(&const_COMPRESSION_ZSTD_MIN_value, ZSTD_minCLevel());
1873+
zend_string *const_COMPRESSION_ZSTD_MIN_name = zend_string_init_interned("COMPRESSION_ZSTD_MIN", sizeof("COMPRESSION_ZSTD_MIN") - 1, 1);
1874+
zend_declare_class_constant_ex(class_entry, const_COMPRESSION_ZSTD_MIN_name, &const_COMPRESSION_ZSTD_MIN_value, ZEND_ACC_PUBLIC, NULL);
1875+
zend_string_release(const_COMPRESSION_ZSTD_MIN_name);
1876+
#endif
1877+
#if defined(HAVE_REDIS_ZSTD) && !(ZSTD_VERSION_NUMBER >= 10400)
1878+
1879+
zval const_COMPRESSION_ZSTD_MIN_value;
1880+
ZVAL_LONG(&const_COMPRESSION_ZSTD_MIN_value, 1);
1881+
zend_string *const_COMPRESSION_ZSTD_MIN_name = zend_string_init_interned("COMPRESSION_ZSTD_MIN", sizeof("COMPRESSION_ZSTD_MIN") - 1, 1);
1882+
zend_declare_class_constant_ex(class_entry, const_COMPRESSION_ZSTD_MIN_name, &const_COMPRESSION_ZSTD_MIN_value, ZEND_ACC_PUBLIC, NULL);
1883+
zend_string_release(const_COMPRESSION_ZSTD_MIN_name);
18761884
#endif
18771885
#if defined(HAVE_REDIS_ZSTD)
18781886

redis_legacy_arginfo.h

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 21f3434814d9fa077a9a81c8ba114c3faf079e85 */
2+
* Stub hash: 04fe88bbcc4d3dc3be06385e8931dfb080442f23 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis___construct, 0, 0, 0)
55
ZEND_ARG_INFO(0, options)
@@ -1715,13 +1715,21 @@ static zend_class_entry *register_class_Redis(void)
17151715
zend_declare_class_constant_ex(class_entry, const_COMPRESSION_ZSTD_DEFAULT_name, &const_COMPRESSION_ZSTD_DEFAULT_value, ZEND_ACC_PUBLIC, NULL);
17161716
zend_string_release(const_COMPRESSION_ZSTD_DEFAULT_name);
17171717
#endif
1718-
#if defined(HAVE_REDIS_ZSTD) && defined(ZSTD_ 8000 CLEVEL_MAX)
1718+
#if defined(HAVE_REDIS_ZSTD) && ZSTD_VERSION_NUMBER >= 10400
17191719

1720-
zval const_COMPRESSION_ZSTD_MAX_value;
1721-
ZVAL_LONG(&const_COMPRESSION_ZSTD_MAX_value, ZSTD_CLEVEL_MAX);
1722-
zend_string *const_COMPRESSION_ZSTD_MAX_name = zend_string_init_interned("COMPRESSION_ZSTD_MAX", sizeof("COMPRESSION_ZSTD_MAX") - 1, 1);
1723-
zend_declare_class_constant_ex(class_entry, const_COMPRESSION_ZSTD_MAX_name, &const_COMPRESSION_ZSTD_MAX_value, ZEND_ACC_PUBLIC, NULL);
1724-
zend_string_release(const_COMPRESSION_ZSTD_MAX_name);
1720+
zval const_COMPRESSION_ZSTD_MIN_value;
1721+
ZVAL_LONG(&const_COMPRESSION_ZSTD_MIN_value, ZSTD_minCLevel());
1722+
zend_string *const_COMPRESSION_ZSTD_MIN_name = zend_string_init_interned("COMPRESSION_ZSTD_MIN", sizeof("COMPRESSION_ZSTD_MIN") - 1, 1);
1723+
zend_declare_class_constant_ex(class_entry, const_COMPRESSION_ZSTD_MIN_name, &const_COMPRESSION_ZSTD_MIN_value, ZEND_ACC_PUBLIC, NULL);
1724+
zend_string_release(const_COMPRESSION_ZSTD_MIN_name);
1725+
#endif
1726+
#if defined(HAVE_REDIS_ZSTD) && !(ZSTD_VERSION_NUMBER >= 10400)
1727+
1728+
zval const_COMPRESSION_ZSTD_MIN_value;
1729+
ZVAL_LONG(&const_COMPRESSION_ZSTD_MIN_value, 1);
1730+
zend_string *const_COMPRESSION_ZSTD_MIN_name = zend_string_init_interned("COMPRESSION_ZSTD_MIN", sizeof("COMPRESSION_ZSTD_MIN") - 1, 1);
1731+
zend_declare_class_constant_ex(class_entry, const_COMPRESSION_ZSTD_MIN_name, &const_COMPRESSION_ZSTD_MIN_value, ZEND_ACC_PUBLIC, NULL);
1732+
zend_string_release(const_COMPRESSION_ZSTD_MIN_name);
17251733
#endif
17261734
#if defined(HAVE_REDIS_ZSTD)
17271735

0 commit comments

Comments
 (0)
0