Skip to content

Commit

Permalink
Rework how we declare ZSTD min/max constants.
Browse files Browse the repository at this point in the history
These values are actually runtime in nature and can be retrieved with
`ZSTD_minCLevel()` and `ZSTD_maxCLevel()` respectively.

Fixes #2487
  • Loading branch information
michael-grunder committed May 14, 2024
1 parent f865d5b commit afa683a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions redis.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,14 @@ class Redis {
public const COMPRESSION_ZSTD_DEFAULT = 3;
#endif

#ifdef ZSTD_CLEVEL_MAX
#ifdef HAVE_REDIS_ZSTD
/**
*
* @var int
* @cvalue ZSTD_CLEVEL_MAX
* @cvalue ZSTD_minCLevel()
*
*/
public const COMPRESSION_ZSTD_MAX = UNKNOWN;
public const COMPRESSION_ZSTD_MIN = UNKNOWN;
#endif

/**
Expand Down
14 changes: 7 additions & 7 deletions redis_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 21f3434814d9fa077a9a81c8ba114c3faf079e85 */
* Stub hash: a6121e9a89fe02809e70e402d3674ed1b415c958 */

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis___construct, 0, 0, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, options, IS_ARRAY, 1, "null")
Expand Down Expand Up @@ -1866,13 +1866,13 @@ static zend_class_entry *register_class_Redis(void)
zend_declare_class_constant_ex(class_entry, const_COMPRESSION_ZSTD_DEFAULT_name, &const_COMPRESSION_ZSTD_DEFAULT_value, ZEND_ACC_PUBLIC, NULL);
zend_string_release(const_COMPRESSION_ZSTD_DEFAULT_name);
#endif
#if defined(HAVE_REDIS_ZSTD) && defined(ZSTD_CLEVEL_MAX)
#if defined(HAVE_REDIS_ZSTD) && defined(HAVE_REDIS_ZSTD)

zval const_COMPRESSION_ZSTD_MAX_value;
ZVAL_LONG(&const_COMPRESSION_ZSTD_MAX_value, ZSTD_CLEVEL_MAX);
zend_string *const_COMPRESSION_ZSTD_MAX_name = zend_string_init_interned("COMPRESSION_ZSTD_MAX", sizeof("COMPRESSION_ZSTD_MAX") - 1, 1);
zend_declare_class_constant_ex(class_entry, const_COMPRESSION_ZSTD_MAX_name, &const_COMPRESSION_ZSTD_MAX_value, ZEND_ACC_PUBLIC, NULL);
zend_string_release(const_COMPRESSION_ZSTD_MAX_name);
zval const_COMPRESSION_ZSTD_MIN_value;
ZVAL_LONG(&const_COMPRESSION_ZSTD_MIN_value, ZSTD_minCLevel());
zend_string *const_COMPRESSION_ZSTD_MIN_name = zend_string_init_interned("COMPRESSION_ZSTD_MIN", sizeof("COMPRESSION_ZSTD_MIN") - 1, 1);
zend_declare_class_constant_ex(class_entry, const_COMPRESSION_ZSTD_MIN_name, &const_COMPRESSION_ZSTD_MIN_value, ZEND_ACC_PUBLIC, NULL);
zend_string_release(const_COMPRESSION_ZSTD_MIN_name);
#endif
#if defined(HAVE_REDIS_ZSTD)

Expand Down
14 changes: 7 additions & 7 deletions redis_legacy_arginfo.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 21f3434814d9fa077a9a81c8ba114c3faf079e85 */
* Stub hash: a6121e9a89fe02809e70e402d3674ed1b415c958 */

ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Redis___construct, 0, 0, 0)
ZEND_ARG_INFO(0, options)
Expand Down Expand Up @@ -1715,13 +1715,13 @@ static zend_class_entry *register_class_Redis(void)
zend_declare_class_constant_ex(class_entry, const_COMPRESSION_ZSTD_DEFAULT_name, &const_COMPRESSION_ZSTD_DEFAULT_value, ZEND_ACC_PUBLIC, NULL);
zend_string_release(const_COMPRESSION_ZSTD_DEFAULT_name);
#endif
#if defined(HAVE_REDIS_ZSTD) && defined(ZSTD_CLEVEL_MAX)
#if defined(HAVE_REDIS_ZSTD) && defined(HAVE_REDIS_ZSTD)

zval const_COMPRESSION_ZSTD_MAX_value;
ZVAL_LONG(&const_COMPRESSION_ZSTD_MAX_value, ZSTD_CLEVEL_MAX);
zend_string *const_COMPRESSION_ZSTD_MAX_name = zend_string_init_interned("COMPRESSION_ZSTD_MAX", sizeof("COMPRESSION_ZSTD_MAX") - 1, 1);
zend_declare_class_constant_ex(class_entry, const_COMPRESSION_ZSTD_MAX_name, &const_COMPRESSION_ZSTD_MAX_value, ZEND_ACC_PUBLIC, NULL);
zend_string_release(const_COMPRESSION_ZSTD_MAX_name);
zval const_COMPRESSION_ZSTD_MIN_value;
ZVAL_LONG(&const_COMPRESSION_ZSTD_MIN_value, ZSTD_minCLevel());
zend_string *const_COMPRESSION_ZSTD_MIN_name = zend_string_init_interned("COMPRESSION_ZSTD_MIN", sizeof("COMPRESSION_ZSTD_MIN") - 1, 1);
zend_declare_class_constant_ex(class_entry, const_COMPRESSION_ZSTD_MIN_name, &const_COMPRESSION_ZSTD_MIN_value, ZEND_ACC_PUBLIC, NULL);
zend_string_release(const_COMPRESSION_ZSTD_MIN_name);
#endif
#if defined(HAVE_REDIS_ZSTD)

Expand Down

0 comments on commit afa683a

Please sign in to comment.