From 2117cb9dea9b7b834ecf5791f1e0e44988688678 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Tue, 25 Jul 2023 17:39:44 +0600 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=BE=20=D1=81=D0=BE=D1=85=D1=80=D0=B0=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/model/save.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/source/model/save.c b/source/model/save.c index d5b2110..e7ac2bc 100644 --- a/source/model/save.c +++ b/source/model/save.c @@ -155,12 +155,20 @@ char* save_format_key(config_u_g_p* config, int index) { char* save_format_str_value(config_u_g_p* config, int index) { - char* value = yon_char_new(""); - value = philos_format_cfg_str_size_memory(value, config->soft_restriction_size,config->soft_restriction_size_pow); - value = yon_char_unite(value, ":", NULL); - value = philos_format_cfg_str_size_memory(value, config->severe_limitation_size,config->severe_limitation_size_pow); - value = yon_char_unite(value, ":", NULL); - value = yon_char_unite(value, yon_char_from_int(config->soft_restriction_file), NULL); + char* value = NULL; + if (config->soft_restriction_size) { + value = yon_char_unite(philos_format_cfg_str_size_memory("", config->soft_restriction_size,config->soft_restriction_size_pow), NULL); + } + else { + value = yon_char_new("0"); + } + if (config->severe_limitation_size) { + value = yon_char_unite(value, ":", philos_format_cfg_str_size_memory("", config->severe_limitation_size,config->severe_limitation_size_pow), NULL); + } + else { + value = yon_char_unite(value,":0", NULL); + } + value = yon_char_unite(value, ":", yon_char_from_int(config->soft_restriction_file), NULL); value = yon_char_unite(value, ":", NULL); value = yon_char_unite(value, yon_char_from_int(config->severe_limitation_file), NULL); value = yon_char_unite(value, ":", NULL);