From f98ad8b4310fd87517115df478fa6d2cb0ce00b3 Mon Sep 17 00:00:00 2001 From: Igor Belitskiy Date: Tue, 4 Jul 2023 10:36:38 +0600 Subject: [PATCH] =?UTF-8?q?=D0=A7=D0=B0=D1=81=D1=82=D0=B8=D1=87=D0=BD?= =?UTF-8?q?=D0=BE=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=B4=D0=B0=D1=87=D1=83=20=E2=84=9613?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/ubl-settings-resourcequota.c | 41 +++++++++++++---------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/source/ubl-settings-resourcequota.c b/source/ubl-settings-resourcequota.c index e78cf56..cb76684 100644 --- a/source/ubl-settings-resourcequota.c +++ b/source/ubl-settings-resourcequota.c @@ -1,4 +1,5 @@ #include "ubl-settings-resourcequota.h" +#include "ubl-utils.h" config main_config; main_window *widgets; @@ -611,7 +612,6 @@ void tree_view_add(int index) { main_config.i_o_limit_write = yon_remalloc(main_config.i_o_limit_write, (main_config.size_tree_view + 1) * sizeof(int*)); main_config.i_o_limit_write_size = yon_remalloc(main_config.i_o_limit_write_size, (main_config.size_tree_view + 1) * sizeof(int*)); - main_config.disk = yon_remalloc(main_config.disk, (main_config.size_tree_view + 1) * sizeof(char**)); philos_array_int_copy(&main_config.i_o_limit_write[main_config.size_tree_view], add_get_write_device()); philos_array_int_copy(&main_config.i_o_limit_write_size[main_config.size_tree_view], add_get_write_device_size_pow()); @@ -670,9 +670,16 @@ char* format_io_limit_in_tree_view(config_str* disk, int** i_o_limit, int** i_o_ if (!strstr(str, "-")) { char* num_and_pow_size = philos_format_cfg_str_size_memory(" ", i_o_limit[index][index_to_n2] , i_o_limit_size[index][index_to_n2]); if (!strstr(num_and_pow_size, "-")) { - str = yon_char_unite(str, ",", - disk[index][index_to_n2], " ", - num_and_pow_size, NULL); + if (strlen(str)>3) { + str = yon_char_unite(str, ",", + disk[index][index_to_n2], + num_and_pow_size, NULL); + } + else { + str = yon_char_unite(disk[index][index_to_n2], + num_and_pow_size, NULL); + } + } free(num_and_pow_size); } @@ -683,7 +690,7 @@ char* format_io_limit_in_tree_view(config_str* disk, int** i_o_limit, int** i_o_ char* num_and_pow_size = philos_format_cfg_str_size_memory(" ", i_o_limit[index][index_to_n2], i_o_limit_size[index][index_to_n2]); if (!strstr(num_and_pow_size, "-")) { str = yon_char_unite(str, - disk[index][index_to_n2], " ", + disk[index][index_to_n2], num_and_pow_size, NULL); } free(num_and_pow_size); @@ -1043,25 +1050,15 @@ char* add_io_str_format_ubconfig(char* key, int** i_o_limit, int** i_o_limit_s if (i_o_limit_size[index] == NULL) {return NULL;} if (i_o_limit[index] == NULL) {return NULL;} int len_array = 0; - for (int i = 0;i_o_limit[index][i] != -2; i++) { - len_array += 1; - } - for (int i=0; i= 0 && read_disk && read_limit_size >= 0) { - if (i==0 && strlen(cmd_io) < 3) { - cmd_io = yon_char_unite(cmd_io, key, "=", NULL); - } - char* num_and_pow_size = philos_format_cfg_str_size_memory("",read_limit, read_limit_size); - cmd_io = yon_char_unite(cmd_io, split_simvol, read_disk, " ",num_and_pow_size, NULL); - split_simvol[0] = ','; - split_simvol[1] = '\0'; - free(num_and_pow_size); - } + cmd_io = format_io_limit_in_tree_view(disk, i_o_limit, i_o_limit_size, index); + if (strlen(cmd_io) > 5) { + return yon_char_unite(key, "=", cmd_io, NULL); + } + else { + return yon_char_new(""); } return cmd_io; + }