Исправил баг с удалением из таблицы

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

@ -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-43-g3f8aab0"; string version_application = "1.2-44-g708ecfc";
static char *local; static char *local;

@ -671,7 +671,7 @@ void philos_split_size_memory(char* str_value, int* size, char* pow_memory) {
} }
char* philos_format_cfg_str_size_memory(char* str_key, int value, int pow_size_memory) { char* philos_format_cfg_str_size_memory(char* str_key, int value, int pow_size_memory) {
if (value == -1 || pow_size_memory == -3) { if (value == -1 || value == -3 || pow_size_memory == -3) {
return yon_char_new("-"); return yon_char_new("-");
} }
char* str_value = yon_char_from_int(value); char* str_value = yon_char_from_int(value);
@ -768,10 +768,10 @@ char*** yon_char_parsed_shrink_n3(char ***char_string, int *size, int item_to_de
flag = 1; flag = 1;
} }
if (flag == 0) { if (flag == 0) {
yon_char_parsed_copy(&char_string[i], &new_char_parsed[i]); yon_char_parsed_copy(&new_char_parsed[i],&char_string[i]);
} }
else if (flag == 1 && i!=item_to_delete) { else if (flag == 1 && i!=item_to_delete) {
yon_char_parsed_copy(&char_string[i], &new_char_parsed[i-1]); yon_char_parsed_copy(&new_char_parsed[i-1], &char_string[i]);
} }
} }
(*size)=(*size)-1; (*size)=(*size)-1;
@ -884,18 +884,12 @@ 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]; new_int[0] = (*copy)[0];
if ((*copy)[0] == -2) {
yon_int_array_append(&new_int,(*copy)[0]);
}
else {
new_int[1] = -2; new_int[1] = -2;
int i = 2; int i = 2;
for (i=1;(*copy)[i]!=-2;i++) { for (i=1;(*copy)[i]!=-2;i++) {
yon_int_array_append(&new_int,(*copy)[i]); yon_int_array_append(&new_int,(*copy)[i]);
} }
}
*source=new_int; *source=new_int;
} }
// parsing functions // parsing functions
@ -1519,10 +1513,10 @@ int** remove_element_int_array_n3(int** array, int* size, int item_to_delete) {
flag = 1; flag = 1;
} }
if (flag == 0) { if (flag == 0) {
philos_array_int_copy(&array[i],&new_int_parsed[i]); philos_array_int_copy(&new_int_parsed[i],&array[i]);
} }
else if (flag == 1 && i!=item_to_delete) { else if (flag == 1 && i!=item_to_delete) {
philos_array_int_copy(&array[i],&new_int_parsed[i-1]); philos_array_int_copy(&new_int_parsed[i-1],&array[i]);
} }
} }
(*size)=(*size)-1; (*size)=(*size)-1;

Loading…
Cancel
Save