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);