Исправил баг с записью в конфиг

pull/4/head
Igor Belitskiy 2 years ago
parent 1c055b0922
commit fe494e3321

@ -334,24 +334,23 @@ void template_load_cfg(char* cmd, dictionary* load_cfg) {
void init_cfg_array(int index) { void init_cfg_array(int index) {
//main_config.disk = yon_char_parsed_append(main_config.disk, &index, "-"); //main_config.disk = yon_char_parsed_append(main_config.disk, &index, "-");
//index--; //index--;
set_pow_size_memory("-", &main_config.type_quota_size, index); philos_set_pow_size_memory("-", &main_config.type_quota_size, index, array_size_pow);
set_size_memory_integer_char("-", &main_config.type_quota, index); philos_set_size_memory_integer_char("-", &main_config.type_quota, index);
set_pow_size_memory("-", &main_config.quota_volume_size, index); philos_set_pow_size_memory("-", &main_config.quota_volume_size, index, array_size_pow);
set_size_memory_integer_char("-", &main_config.quota_volume, index); philos_set_size_memory_integer_char("-", &main_config.quota_volume, index);
set_pow_size_memory("-", &main_config.cpu_limit_size, index); philos_set_pow_size_memory("-", &main_config.cpu_limit_size, index, array_size_pow);
set_size_memory_integer("-", &main_config.cpu_limit, index); set_size_memory_integer("-", &main_config.cpu_limit, index);
set_pow_size_memory("-", &main_config.soft_raw_limit_size, index); philos_set_pow_size_memory("-", &main_config.soft_raw_limit_size, index, array_size_pow);
set_size_memory_integer("-", &main_config.soft_raw_limit, index); set_size_memory_integer("-", &main_config.soft_raw_limit, index);
set_pow_size_memory("-", &main_config.hard_raw_limit_size, index); philos_set_pow_size_memory("-", &main_config.hard_raw_limit_size, index, array_size_pow);
set_size_memory_integer("-", &main_config.hard_raw_limit, index); set_size_memory_integer("-", &main_config.hard_raw_limit, index);
set_pow_size_memory("-", &main_config.swap_size, index); philos_set_pow_size_memory("-", &main_config.swap_size, index, array_size_pow);
set_size_memory_integer("-",&main_config.swap , index); set_size_memory_integer("-",&main_config.swap , index);
} }
void str_split_key(char* source_value, int index) { void str_split_key(char* source_value, int index) {
@ -431,19 +430,19 @@ void str_split_value(char* values, int index) {
get_param_io_limit(arr_values, index_1, size,index, "IOWriteBandwidthMax"); get_param_io_limit(arr_values, index_1, size,index, "IOWriteBandwidthMax");
} }
if (yon_char_find_count(key, "MemoryHigh") != 0) { if (yon_char_find_count(key, "MemoryHigh") != 0) {
set_pow_size_memory(yon_char_new(value), &main_config.soft_raw_limit_size, index); philos_set_pow_size_memory(yon_char_new(value), &main_config.soft_raw_limit_size, index, array_size_pow);
set_size_memory_integer(yon_char_new(value), &main_config.soft_raw_limit, index); set_size_memory_integer(yon_char_new(value), &main_config.soft_raw_limit, index);
} }
if (yon_char_find_count(key, "MemoryMax") != 0) { if (yon_char_find_count(key, "MemoryMax") != 0) {
set_pow_size_memory(yon_char_new(value), &main_config.hard_raw_limit_size, index); philos_set_pow_size_memory(yon_char_new(value), &main_config.hard_raw_limit_size, index, array_size_pow);
set_size_memory_integer(yon_char_new(value), &main_config.hard_raw_limit, index); set_size_memory_integer(yon_char_new(value), &main_config.hard_raw_limit, index);
} }
if (yon_char_find_count(key, "MemorySwapMax") != 0) { if (yon_char_find_count(key, "MemorySwapMax") != 0) {
set_pow_size_memory(yon_char_new(value), &main_config.swap_size, index); philos_set_pow_size_memory(yon_char_new(value), &main_config.swap_size, index, array_size_pow);
set_size_memory_integer(yon_char_new(value), &main_config.swap, index); set_size_memory_integer(yon_char_new(value), &main_config.swap, index);
} }
if (yon_char_find_count(key, "CPUQuota") != 0) { if (yon_char_find_count(key, "CPUQuota") != 0) {
set_pow_size_memory(yon_char_new(value), &main_config.cpu_limit_size, index); philos_set_pow_size_memory(yon_char_new(value), &main_config.cpu_limit_size, index, array_size_pow);
set_size_memory_integer(yon_char_new(value), &main_config.cpu_limit, index); set_size_memory_integer(yon_char_new(value), &main_config.cpu_limit, index);
} }
} }
@ -466,7 +465,7 @@ void get_param_io_limit(char** arr_values, int index_start, int size, int index_
char* disk = yon_char_divide_search(yon_char_new(value), " ", -1); char* disk = yon_char_divide_search(yon_char_new(value), " ", -1);
array_disk = yon_char_parsed_append(array_disk, &index_n2, disk); array_disk = yon_char_parsed_append(array_disk, &index_n2, disk);
index_n2--; index_n2--;
set_pow_size_memory(yon_char_new(value), &array_limit_size, index_n2); philos_set_pow_size_memory(yon_char_new(value), &array_limit_size, index_n2, array_size_pow);
set_size_memory_integer(yon_char_new(value), &array_limit, index_n2); set_size_memory_integer(yon_char_new(value), &array_limit, index_n2);
flag_parsed = 1; flag_parsed = 1;
index_n2++; index_n2++;
@ -483,7 +482,7 @@ void get_param_io_limit(char** arr_values, int index_start, int size, int index_
char* disk = yon_char_divide_search(yon_char_new(arr_values[i]), " ", -1); char* disk = yon_char_divide_search(yon_char_new(arr_values[i]), " ", -1);
array_disk = yon_char_parsed_append(array_disk, &index_n2, disk); array_disk = yon_char_parsed_append(array_disk, &index_n2, disk);
index_n2--; index_n2--;
set_pow_size_memory(yon_char_new(arr_values[i]), &array_limit_size, index_n2); philos_set_pow_size_memory(yon_char_new(arr_values[i]), &array_limit_size, index_n2, array_size_pow);
set_size_memory_integer(yon_char_new(arr_values[i]), &array_limit, index_n2); set_size_memory_integer(yon_char_new(arr_values[i]), &array_limit, index_n2);
index_n2++; index_n2++;
} }
@ -539,72 +538,6 @@ void set_size_memory_integer(char* str_find, int** array_data, int index) {
} }
void set_size_memory_integer_char(char* str_find, char*** array_data, int index) {
char* simv_del_array[10] = {"K","M","G","T","k","m","g","t"," ","%"};
for (size_t i = 0; i < 10; i++) {
if (strstr(str_find, simv_del_array[i])) {
str_find = yon_char_divide_search(str_find, simv_del_array[i], -1);
}
}
if (strstr(str_find, " ") != NULL) {
char* mem_s = yon_char_new(str_find);
yon_char_divide_search(mem_s, " ", -1);
*array_data = yon_char_parsed_append(*array_data, &index, mem_s);
}
if (strstr(str_find, "-") != NULL) {
*array_data = yon_char_parsed_append(*array_data, &index, "-");
}
else {
if (str_find[0] == '\"') {
yon_char_divide(str_find, 0);
size_t length = strlen(str_find);
str_find = yon_char_divide(str_find, length-2);
}
if (strstr(str_find, " ") == NULL) {
*array_data = yon_char_parsed_append(*array_data, &index, str_find);
}
}
}
void set_pow_size_memory(char* str_find, int** array_size,int index) {
size_t length = strlen(str_find);
if (strstr(str_find,"K") != NULL) {
*array_size = philos_int_append(*array_size, &index, 0);
str_find = yon_char_divide(str_find, length-1);
str_find = yon_char_unite(str_find, " ", STR_KB, NULL);
index--;
}
else if (strstr(str_find,"M") != NULL) {
*array_size = philos_int_append(*array_size, &index, 1);
str_find = yon_char_divide(str_find, length-1);
str_find = yon_char_unite(str_find," ", STR_MB, NULL);
index--;
}
else if (strstr(str_find,"G") != NULL) {
*array_size = philos_int_append(*array_size, &index, 2);
str_find = yon_char_divide(str_find, length-1);
str_find = yon_char_unite(str_find," ", STR_GB, NULL);
index--;
}
else if (strstr(str_find,"T") != NULL) {
*array_size = philos_int_append(*array_size, &index, 3);
str_find = yon_char_divide(str_find, length-1);
str_find = yon_char_unite(str_find," ", STR_TB, NULL);
index--;
}
else if (strstr(str_find,"%%") != NULL) {
*array_size = philos_int_append(*array_size, &index, -1);
str_find = yon_char_divide(str_find, length-1);
index--;
}
else if (strstr(str_find,"-") != NULL) {
*array_size = philos_int_append(*array_size, &index, -1);
index--;
}
}
void main_cbx_2_event() { void main_cbx_2_event() {
int menu_id = gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->cbtMainInfoLevel2)); int menu_id = gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->cbtMainInfoLevel2));
char* cmd_text_param = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->cbtMainInfoLevel2)); char* cmd_text_param = gtk_combo_box_text_get_active_text(GTK_COMBO_BOX_TEXT(widgets->cbtMainInfoLevel2));
@ -1033,52 +966,36 @@ char* save_format_value(int index) {
split_simvol[0] = 0; split_simvol[0] = 0;
split_simvol[1] = 0; split_simvol[1] = 0;
if (main_config.soft_raw_limit[index]==0) { if (main_config.soft_raw_limit[index]==0) {
char* value1 = yon_char_unite(philos_format_cfg_str_size_memory("MemoryHigh=", main_config.soft_raw_limit[index],main_config.soft_raw_limit_size[index]),NULL); char* value_size = philos_format_cfg_str_size_memory("MemoryHigh=", main_config.soft_raw_limit[index],main_config.soft_raw_limit_size[index]);
if (strstr(value1,"-")) { if (!strstr(value_size,"-")) {
free(value1); value = yon_char_unite(value ,split_simvol, value_size, NULL);
}
else {
value = yon_char_new(value1);
free(value1);
split_simvol[0] = ','; split_simvol[0] = ',';
split_simvol[1] = '\0'; split_simvol[1] = '\0';
} }
free(value_size);
} }
if (main_config.hard_raw_limit[index]==0) { if (main_config.hard_raw_limit[index]==0) {
char* value1 = yon_char_unite(value ,split_simvol, philos_format_cfg_str_size_memory("MemoryMax=", main_config.hard_raw_limit[index],main_config.hard_raw_limit_size[index]), NULL); char* value_size = philos_format_cfg_str_size_memory("MemoryMax=", main_config.hard_raw_limit[index],main_config.hard_raw_limit_size[index]);
if (strstr(value1,"-")) { if (!strstr(value_size,"-")) {
free(value1); value = yon_char_unite(value ,split_simvol, value_size, NULL);
}
else {
value = yon_char_new(value1);
free(value1);
split_simvol[0] = ','; split_simvol[0] = ',';
split_simvol[1] = '\0'; split_simvol[1] = '\0';
} }
free(value_size);
} }
if (main_config.swap[index]==0) { if (main_config.swap[index]==0) {
char* value1 = yon_char_unite(value ,split_simvol, philos_format_cfg_str_size_memory("MemorySwapMax=", main_config.swap[index],main_config.swap_size[index]), NULL); char* value_size = philos_format_cfg_str_size_memory("MemorySwapMax=", main_config.swap[index],main_config.swap_size[index]);
if (strstr(value1,"-")) { if (!strstr(value_size,"-")) {
free(value1); value = yon_char_unite(value ,split_simvol, value_size, NULL);
}
else {
value = yon_char_new(value1);
free(value1);
split_simvol[0] = ','; split_simvol[0] = ',';
split_simvol[1] = '\0'; split_simvol[1] = '\0';
} }
free(value_size);
} }
if (main_config.cpu_limit[index]==0) { if (main_config.cpu_limit[index]>=0) {
char* value1 = yon_char_unite(value ,split_simvol,"CPUQuota=", main_config.cpu_limit[index], NULL); value = yon_char_unite(value ,split_simvol,"CPUQuota=", yon_char_from_int(main_config.cpu_limit[index]), "%", NULL);
if (strstr(value1,"-")) { split_simvol[0] = ',';
free(value1); split_simvol[1] = '\0';
}
else {
value = yon_char_new(value1);
free(value1);
split_simvol[0] = ',';
split_simvol[1] = '\0';
}
} }
value = add_io_str_format_ubconfig(value, "IOReadBandwidthMax", main_config.i_o_limit_read, main_config.i_o_limit_read_size, main_config.disk, index); value = add_io_str_format_ubconfig(value, "IOReadBandwidthMax", main_config.i_o_limit_read, main_config.i_o_limit_read_size, main_config.disk, index);
value = add_io_str_format_ubconfig(value, "IOWriteBandwidthMax", main_config.i_o_limit_write, main_config.i_o_limit_write_size, main_config.disk, index); value = add_io_str_format_ubconfig(value, "IOWriteBandwidthMax", main_config.i_o_limit_write, main_config.i_o_limit_write_size, main_config.disk, index);
@ -1086,33 +1003,36 @@ char* save_format_value(int index) {
} }
char* add_io_str_format_ubconfig(char* cmd_io, char* key, int** i_o_limit, int** i_o_limit_size, char*** disk, int index) { char* add_io_str_format_ubconfig(char* cmd_io, char* key, int** i_o_limit, int** i_o_limit_size, char*** disk, int index) {
char split_simvol[2] = {0}; char split_simvol[2] = {0};
if (i_o_limit) { if (i_o_limit== NULL) {return cmd_io;}
if (i_o_limit[index] != NULL) { if (i_o_limit_size[index] == NULL) {return cmd_io;}
if (i_o_limit[index] != NULL) { if (i_o_limit[index] == NULL) {return cmd_io;}
for (int i = 0;i_o_limit[index][i] != -2; i++) { int len_array = 0;
if (i==0 && strlen(cmd_io) == 0) { for (int i = 0;i_o_limit[index][i] != -2; i++) {
cmd_io = yon_char_unite(cmd_io, ",", key, "=", NULL); len_array += 1;
} }
if (cmd_io == NULL) { for (int i=0; i<len_array; i++) {
cmd_io = yon_char_new(""); if (i==0 && strlen(cmd_io) < 3) {
} cmd_io = yon_char_unite(cmd_io, key, "=", NULL);
int read_limit = i_o_limit[index][i]; }
char* read_disk = disk[index][i]; else if (i==0 && strlen(cmd_io) > 3) {
int read_limit_size = i_o_limit_size[index][i]; cmd_io = yon_char_unite(cmd_io, ",", key, "=", NULL);
if (read_limit >= 0 && read_disk && read_limit_size >= 0) { }
char* num_and_pow_size = philos_format_cfg_str_size_memory("",read_limit, read_limit_size); puts(cmd_io);
cmd_io = yon_char_unite(cmd_io, split_simvol, read_disk, " ",num_and_pow_size, NULL); int read_limit = i_o_limit[index][i];
split_simvol[0] = ','; char* read_disk = disk[index][i];
split_simvol[1] = '\0'; int read_limit_size = i_o_limit_size[index][i];
} if (read_limit >= 0 && read_disk && read_limit_size >= 0) {
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);
} }
} }
return cmd_io; return cmd_io;
} }
int check_save(dictionary* load_cfg) { int check_save(dictionary* load_cfg) {
if (main_config.flag_set_data == 1) { if (main_config.flag_set_data == 1) {
return 0; return 0;
@ -1159,6 +1079,7 @@ char* template_format_str_set_save(dictionary* load_cfg, char* source_set_cmd) {
value = yon_char_new(save_format_value(index)); value = yon_char_new(save_format_value(index));
if (key != NULL && value != NULL) { if (key != NULL && value != NULL) {
cmd = yon_char_unite(cmd, " " , key, "=\"" , value, "\"\n", NULL); cmd = yon_char_unite(cmd, " " , key, "=\"" , value, "\"\n", NULL);
puts(cmd);
flag_save = 1; flag_save = 1;
} }
if (key != NULL) { if (key != NULL) {
@ -1237,6 +1158,11 @@ int main(int argc, char *argv[]){
local=setlocale(LC_ALL, ""); local=setlocale(LC_ALL, "");
textdomain (LocaleName); textdomain (LocaleName);
config_init(); config_init();
int size_array_size_pow = 0;
array_size_pow = yon_char_parsed_append(array_size_pow,&size_array_size_pow, STR_KB);
array_size_pow = yon_char_parsed_append(array_size_pow,&size_array_size_pow, STR_MB);
array_size_pow = yon_char_parsed_append(array_size_pow,&size_array_size_pow, STR_GB);
array_size_pow = yon_char_parsed_append(array_size_pow,&size_array_size_pow, STR_TB);
int option_index=0; int option_index=0;
int show_help=0; int show_help=0;
{ {
@ -1332,5 +1258,6 @@ int main(int argc, char *argv[]){
load_global_cfg(); load_global_cfg();
load_system_cfg(); load_system_cfg();
gtk_main(); gtk_main();
philos_free_string_array(&array_size_pow, size_array_size_pow);
} }

@ -43,7 +43,7 @@
#define CMD_GET_GROUP "cut -d: -f1 /etc/group" #define CMD_GET_GROUP "cut -d: -f1 /etc/group"
typedef char *string; typedef char *string;
string version_application = "1.2-44-g708ecfc"; string version_application = "1.2-45-g1c055b0";
static char *local; static char *local;

@ -62,6 +62,76 @@ void philos_array_string_remove_char(char*** array, char* str_remove, int size)
} }
} }
void philos_set_pow_size_memory(char* str_find, int** array_size,int index, char** array_size_pow) {
char* STR_KB = array_size_pow[0];
char* STR_MB = array_size_pow[1];
char* STR_GB = array_size_pow[2];
char* STR_TB = array_size_pow[3];
size_t length = strlen(str_find);
if (strstr(str_find,"K") != NULL) {
*array_size = philos_int_append(*array_size, &index, 0);
str_find = yon_char_divide(str_find, length-1);
str_find = yon_char_unite(str_find, " ", STR_KB, NULL);
index--;
}
else if (strstr(str_find,"M") != NULL) {
*array_size = philos_int_append(*array_size, &index, 1);
str_find = yon_char_divide(str_find, length-1);
str_find = yon_char_unite(str_find," ", STR_MB, NULL);
index--;
}
else if (strstr(str_find,"G") != NULL) {
*array_size = philos_int_append(*array_size, &index, 2);
str_find = yon_char_divide(str_find, length-1);
str_find = yon_char_unite(str_find," ", STR_GB, NULL);
index--;
}
else if (strstr(str_find,"T") != NULL) {
*array_size = philos_int_append(*array_size, &index, 3);
str_find = yon_char_divide(str_find, length-1);
str_find = yon_char_unite(str_find," ", STR_TB, NULL);
index--;
}
else if (strstr(str_find,"%%") != NULL) {
*array_size = philos_int_append(*array_size, &index, -1);
str_find = yon_char_divide(str_find, length-1);
index--;
}
else if (strstr(str_find,"-") != NULL) {
*array_size = philos_int_append(*array_size, &index, -1);
index--;
}
}
void philos_set_size_memory_integer_char(char* str_find, char*** array_data, int index) {
char* simv_del_array[10] = {"K","M","G","T","k","m","g","t"," ","%"};
for (size_t i = 0; i < 10; i++) {
if (strstr(str_find, simv_del_array[i])) {
str_find = yon_char_divide_search(str_find, simv_del_array[i], -1);
}
}
if (strstr(str_find, " ") != NULL) {
char* mem_s = yon_char_new(str_find);
yon_char_divide_search(mem_s, " ", -1);
*array_data = yon_char_parsed_append(*array_data, &index, mem_s);
}
if (strstr(str_find, "-") != NULL) {
*array_data = yon_char_parsed_append(*array_data, &index, "-");
}
else {
if (str_find[0] == '\"') {
yon_char_divide(str_find, 0);
size_t length = strlen(str_find);
str_find = yon_char_divide(str_find, length-2);
}
if (strstr(str_find, " ") == NULL) {
*array_data = yon_char_parsed_append(*array_data, &index, str_find);
}
}
}
dictionary *yon_dictionary_create_conneced(dictionary *targetdict) dictionary *yon_dictionary_create_conneced(dictionary *targetdict)
{ {
@ -883,13 +953,20 @@ void yon_int_array_append(int **source, int append){
void philos_array_int_copy(int** source, int** copy) { void philos_array_int_copy(int** source, int** copy) {
int * new_int = g_malloc0(sizeof(int)*2); int * new_int = g_malloc0(sizeof(int)*2);
new_int[0] = (*copy)[0]; if ((*copy)[0] != -2) {
new_int[1] = -2; new_int[0] = (*copy)[0];
int i = 2; new_int[1] = -2;
for (i=1;(*copy)[i]!=-2;i++) { int i = 2;
yon_int_array_append(&new_int,(*copy)[i]); for (i=1;(*copy)[i]!=-2;i++) {
yon_int_array_append(&new_int,(*copy)[i]);
}
*source=new_int;
}
else {
new_int[0] = (*copy)[0];
*source=new_int;
} }
*source=new_int;
} }
// parsing functions // parsing functions
@ -1866,19 +1943,24 @@ void philos_set_spin_adjustment(GtkWidget *check, GtkWidget *spin, GtkWidget *co
} }
void philos_set_active_widgets(GtkWidget *check, GtkWidget *spin, GtkWidget *combo, int flag_cpu, char* cmd) { void philos_set_active_widgets(GtkWidget *check, GtkWidget *spin, GtkWidget *combo, int flag_cpu, char* cmd) {
gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check)); gboolean active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check));
size_t value_spin = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin));
gtk_widget_set_sensitive(spin, active); gtk_widget_set_sensitive(spin, active);
gtk_widget_set_sensitive(combo, active); gtk_widget_set_sensitive(combo, active);
if (gtk_spin_button_get_digits(GTK_SPIN_BUTTON(spin))>0) { size_t resurs = get_resurs_total(cmd);
if (value_spin>0) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),1); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),1);
} }
else if (active == 0) { else if (active == 0) {
gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), 0); gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), 0);
} }
if (flag_cpu == 0) { if (flag_cpu == 0) {
philos_set_spin_adjustment(check, spin, combo, get_resurs_total(cmd)); philos_set_spin_adjustment(check, spin, combo, resurs);
if (value_spin>resurs) {
gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), resurs);
}
} }
else { else {
philos_set_spin_adjustment(check, spin, NULL, get_resurs_total(cmd)); philos_set_spin_adjustment(check, spin, NULL, resurs);
} }
} }

@ -14,6 +14,7 @@
#include <pwd.h> #include <pwd.h>
#include <stdbool.h> #include <stdbool.h>
#include "ubl-cmake.h" #include "ubl-cmake.h"
#ifdef WEBKIT_FOUND #ifdef WEBKIT_FOUND
#include <webkit2/webkit2.h> #include <webkit2/webkit2.h>
#endif #endif
@ -37,7 +38,7 @@
#define catch(x) ExitJmp:if(__HadError) #define catch(x) ExitJmp:if(__HadError)
#define throw(x) {__HadError=true;goto ExitJmp;} #define throw(x) {__HadError=true;goto ExitJmp;}
#define file_source_login_min_max "/etc/login.defs" #define file_source_login_min_max "/etc/login.defs"
static char** array_size_pow;
typedef enum typedef enum
{ {
#ifdef __GTK_H__ #ifdef __GTK_H__
@ -204,6 +205,10 @@ char** philos_str_split(char *parameters, int *size, char *divider);
void philos_array_string_remove_char(char*** array, char* str_remove, int size); void philos_array_string_remove_char(char*** array, char* str_remove, int size);
void philos_set_pow_size_memory(char* str_find, int** array_size,int index, char** array_size_pow);
void philos_set_size_memory_integer_char(char* str_find, char*** array_data, int index);
char **yon_char_parsed_shrink(char **char_string, int *size, int item_to_delete); char **yon_char_parsed_shrink(char **char_string, int *size, int item_to_delete);
char*** yon_char_parsed_shrink_n3(char ***char_string, int *size, int item_to_delete); char*** yon_char_parsed_shrink_n3(char ***char_string, int *size, int item_to_delete);

@ -285,15 +285,10 @@ void edit_set_limit_swap(int value, int pow_mem) {
edit_widgets->cmbPaddingFLTemp); edit_widgets->cmbPaddingFLTemp);
} }
void edit_temp_set(int value, int pow_mem, GtkWidget* cheek, GtkWidget* spin, GtkWidget* combo_box_text) { void edit_temp_set(int value, int pow_mem, GtkWidget* cheek, GtkWidget* spin, GtkWidget* combo_box_text) {
char* search = "-"; if (pow_mem!=-3 && pow_mem>=-1 && value>=1) {
char* mem_size_pow = yon_char_from_int(value);
if (strstr(mem_size_pow, search) == 0 && pow_mem!=-3 && pow_mem>=-1) {
int value = atoi(yon_char_divide_search(mem_size_pow, " ", -1));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), value); gtk_spin_button_set_value(GTK_SPIN_BUTTON(spin), value);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cheek), 1); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cheek), 1);
if (combo_box_text != NULL) { if (combo_box_text != NULL) {
// Todo: add code
printf("%d", pow_mem);
gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box_text), pow_mem); gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box_text), pow_mem);
} }
} }

Loading…
Cancel
Save