Replace confini with toml

This commit is contained in:
Tobias Reisinger 2020-11-22 00:56:01 +01:00
parent 25eab5d38e
commit 79b1f3b2cf
27 changed files with 3081 additions and 5926 deletions
src/models

View file

@ -56,9 +56,9 @@ controller_db_select_mapper(sqlite3_stmt *stmt)
break;
}
}
new_controller->relays = malloc(sizeof(relay_t) * global_config.relay_count);
new_controller->relays = malloc(sizeof(relay_t) * global_config->relay_count);
uint8_t i;
for(i = 0; i < global_config.relay_count; ++i)
for(i = 0; i < global_config->relay_count; ++i)
{
new_controller->relays[i] = relay_load(i);
if(!new_controller->relays[i])
@ -198,14 +198,14 @@ controller_create(void)
new_controller->id = 0;
uuid_generate(new_controller->uid);
strncpy(new_controller->name, global_config.name, MAX_NAME_LENGTH);
strncpy(new_controller->name, global_config->name, MAX_NAME_LENGTH);
new_controller->name[MAX_NAME_LENGTH] = '\0';
new_controller->command_port = 0;
new_controller->relays = malloc(sizeof(relay_t) * global_config.relay_count);
new_controller->relays = malloc(sizeof(relay_t) * global_config->relay_count);
uint8_t i;
for(i = 0; i < global_config.relay_count; ++i)
for(i = 0; i < global_config->relay_count; ++i)
{
new_controller->relays[i] = relay_load(i);
if(!new_controller->relays[i])
@ -228,7 +228,7 @@ controller_set_name(controller_t *controller, const char *name)
void
controller_free(controller_t *controller)
{
for(int i = 0; i < global_config.relay_count; ++i)
for(int i = 0; i < global_config->relay_count; ++i)
{
relay_free(controller->relays[i]);
}
@ -249,7 +249,7 @@ controller_debug(controller_t *controller)
LOGGER_DEBUG("(1/3) %s @ %p\n", uuid_str, (void*)controller);
LOGGER_DEBUG("(2/3) name: %s\n", controller->name);
LOGGER_DEBUG("(3/3) relays @ %p:\n", (void*)controller->relays);
for(int i = 0; i < global_config.relay_count; ++i)
for(int i = 0; i < global_config->relay_count; ++i)
{
relay_debug(controller->relays[i]);
}