Skip to content

Commit 214a63f

Browse files
committed
refactor: change default zstd.output_compression_level
1 parent c93ac2e commit 214a63f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

zstd.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,7 @@ static zend_result php_zstd_output_handler_context_start(php_zstd_context *ctx)
12871287
{
12881288
int level = PHP_ZSTD_G(output_compression_level);
12891289

1290-
if (!zstd_check_compress_level(level) || level < 0) {
1290+
if (!zstd_check_compress_level(level) || level == 0) {
12911291
level = ZSTD_CLEVEL_DEFAULT;
12921292
}
12931293

@@ -1605,12 +1605,16 @@ static PHP_INI_MH(OnUpdate_zstd_output_compression)
16051605
return SUCCESS;
16061606
}
16071607

1608+
#define STRINGIFY(n) #n
1609+
#define TOSTRING(n) STRINGIFY(n)
1610+
16081611
PHP_INI_BEGIN()
16091612
STD_PHP_INI_BOOLEAN("zstd.output_compression", "0",
16101613
PHP_INI_ALL, OnUpdate_zstd_output_compression,
16111614
output_compression_default,
16121615
zend_zstd_globals, zstd_globals)
1613-
STD_PHP_INI_ENTRY("zstd.output_compression_level", "-1",
1616+
STD_PHP_INI_ENTRY("zstd.output_compression_level",
1617+
TOSTRING(ZSTD_CLEVEL_DEFAULT),
16141618
PHP_INI_ALL, OnUpdateLong, output_compression_level,
16151619
zend_zstd_globals, zstd_globals)
16161620
STD_PHP_INI_ENTRY("zstd.output_compression_dict", "",

0 commit comments

Comments
 (0)