You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
4.6 KiB
99 lines
4.6 KiB
#include "model.h"
|
|
|
|
|
|
void model_clear_cfg(config_u_g_p* _config) {
|
|
philos_free_int_array(&_config->id, _config->size);
|
|
philos_free_string_array(&_config->name, _config->size);
|
|
philos_free_string_array(&_config->quota, _config->size);
|
|
philos_free_string_array(&_config->quota, _config->size);
|
|
philos_free_string_array(&_config->size_memory, _config->size);
|
|
philos_free_int_array(&_config->soft_restriction_size, _config->size);
|
|
philos_free_int_array(&_config->soft_restriction_file, _config->size);
|
|
philos_free_int_array(&_config->severe_limitation_size, _config->size);
|
|
philos_free_int_array(&_config->severe_limitation_file, _config->size);
|
|
philos_free_int_array(&_config->deferring_size, _config->size);
|
|
philos_free_int_array(&_config->deferring_file, _config->size);
|
|
philos_free_int_array(&_config->size_memory_pow, _config->size);
|
|
philos_free_int_array(&_config->soft_restriction_size_pow, _config->size);
|
|
philos_free_int_array(&_config->soft_restriction_file_pow, _config->size);
|
|
philos_free_int_array(&_config->severe_limitation_size_pow, _config->size);
|
|
philos_free_int_array(&_config->severe_limitation_file_pow, _config->size);
|
|
philos_free_int_array(&_config->deferring_size_pow, _config->size);
|
|
philos_free_int_array(&_config->deferring_file_pow, _config->size);
|
|
philos_free_string_array(&_config->device, _config->size);
|
|
|
|
_config->size = 0;
|
|
}
|
|
|
|
void model_null_cfg(config_u_g_p* _config) {
|
|
if (_config->size == 0) {
|
|
_config->id = NULL;
|
|
_config->name = NULL;
|
|
_config->quota = NULL;
|
|
_config->size_memory = NULL;
|
|
_config->files = NULL;
|
|
_config->soft_restriction_size = NULL;
|
|
_config->soft_restriction_file = NULL;
|
|
_config->severe_limitation_size = NULL;
|
|
_config->severe_limitation_file = NULL;
|
|
_config->deferring_size = NULL;
|
|
_config->deferring_file = NULL;
|
|
_config->size_memory_pow = NULL;
|
|
_config->soft_restriction_size_pow = NULL;
|
|
_config->soft_restriction_file_pow = NULL;
|
|
_config->severe_limitation_size_pow = NULL;
|
|
_config->severe_limitation_file_pow = NULL;
|
|
_config->deferring_size_pow = NULL;
|
|
_config->deferring_file_pow = NULL;
|
|
_config->device = NULL;
|
|
}
|
|
}
|
|
|
|
void model_clear_general(config_general* _config) {
|
|
philos_free_int_array(&_config->flag_status, _config->size);
|
|
|
|
_config->size = 0;
|
|
}
|
|
|
|
void model_null_general(config_general* _config) {
|
|
if (_config->size == 0) {
|
|
_config->flag_status = NULL;
|
|
}
|
|
}
|
|
|
|
void model_tree_view_add(config_u_g_p* _config) {
|
|
model_null_str_writing(_config, _config->size);
|
|
}
|
|
|
|
void model_null_str_writing(config_u_g_p* _config, int index) {
|
|
philos_set_size_memory_integer_char("-", &_config->name, index);
|
|
philos_set_size_memory_integer_char("-", &_config->quota, index);
|
|
philos_set_size_memory_integer_char("-", &_config->size_memory, index);
|
|
philos_set_size_memory_integer_char("-", &_config->files, index);
|
|
philos_set_size_memory_integer_char("-", &_config->device, index);
|
|
philos_set_pow_size_memory("-", &_config->soft_restriction_size, index, array_size_pow);
|
|
philos_set_pow_size_memory("-", &_config->soft_restriction_file, index, array_size_pow);
|
|
philos_set_pow_size_memory("-", &_config->severe_limitation_size, index, array_size_pow);
|
|
philos_set_pow_size_memory("-", &_config->severe_limitation_file, index, array_size_pow);
|
|
philos_set_pow_size_memory("-", &_config->deferring_size, index, array_size_pow);
|
|
philos_set_pow_size_memory("-", &_config->deferring_file, index, array_size_pow);
|
|
philos_set_pow_size_memory("-", &_config->size_memory_pow, index, array_size_pow);
|
|
philos_set_pow_size_memory("-", &_config->soft_restriction_size_pow, index, array_size_pow);
|
|
philos_set_pow_size_memory("-", &_config->soft_restriction_file_pow, index, array_size_pow);
|
|
philos_set_pow_size_memory("-", &_config->severe_limitation_size_pow, index, array_size_pow);
|
|
philos_set_pow_size_memory("-", &_config->severe_limitation_file_pow, index, array_size_pow);
|
|
philos_set_pow_size_memory("-", &_config->deferring_size_pow, index, array_size_pow);
|
|
philos_set_pow_size_memory("-", &_config->deferring_file_pow, index, array_size_pow);
|
|
|
|
}
|
|
|
|
|
|
void model_array_size_memory() {
|
|
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);
|
|
}
|
|
|