1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-09 11:13:12 +02:00

core: make zstd dependency optional (closes #2024)

This commit is contained in:
Sébastien Helleu
2023-10-01 16:36:32 +02:00
parent 879a548bea
commit 6bd0c63192
39 changed files with 697 additions and 213 deletions
+8
View File
@@ -375,6 +375,7 @@ logger_buffer_compress_file (struct t_logger_buffer *logger_buffer)
unlink (filename);
}
break;
#ifdef HAVE_ZSTD
case LOGGER_BUFFER_COMPRESSION_ZSTD:
if (weechat_file_compress (filename, new_filename,
"zstd", compression_level))
@@ -382,6 +383,7 @@ logger_buffer_compress_file (struct t_logger_buffer *logger_buffer)
unlink (filename);
}
break;
#endif
default:
break;
}
@@ -477,6 +479,12 @@ logger_buffer_rotate (struct t_logger_buffer *logger_buffer)
compression_type = weechat_config_enum (
logger_config_file_rotation_compression_type);
#ifndef HAVE_ZSTD
if (compression_type == LOGGER_BUFFER_COMPRESSION_ZSTD)
compression_type = LOGGER_BUFFER_COMPRESSION_NONE;
#endif
ptr_extension = logger_buffer_compression_extension[compression_type];
/* find the highest existing extension index */
+29 -1
View File
@@ -93,6 +93,32 @@ logger_config_change_file_option_restart_log (const void *pointer, void *data,
logger_buffer_adjust_log_filenames ();
}
/*
* Callback for changes on compression type option.
*/
void
logger_config_change_file_rotation_comp_type (const void *pointer,
void *data,
struct t_config_option *option)
{
/* make C compiler happy */
(void) pointer;
(void) data;
(void) option;
#ifndef HAVE_ZSTD
if (weechat_config_enum (option) == LOGGER_BUFFER_COMPRESSION_ZSTD)
{
weechat_printf (NULL,
_("%s%s: zstd compression is not available, "
"logger files will not be compressed"),
weechat_prefix ("error"),
LOGGER_PLUGIN_NAME);
}
#endif
}
/*
* Callback for changes on option "logger.file.color_lines".
*/
@@ -666,7 +692,9 @@ logger_config_init ()
"new type (or decompress files), then change the option in "
"logger.conf, then load the logger plugin"),
"none|gzip|zstd", 0, 0, "none", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
NULL, NULL, NULL,
&logger_config_change_file_rotation_comp_type, NULL, NULL,
NULL, NULL, NULL);
logger_config_file_rotation_size_max = weechat_config_new_option (
logger_config_file, logger_config_section_file,
"rotation_size_max", "string",