Refactor: Rename configuration process functions

This commit is contained in:
0x221E
2026-01-13 23:42:32 +01:00
parent a89589a634
commit 21983b7da6

View File

@@ -72,7 +72,6 @@ void log_write(const char* func, const char* fmt, ...)
/*** file management ***/
long file_get_size(FILE* fd)
{
if(fd == NULL) DIE("fd cannot be NULL.");
@@ -425,7 +424,7 @@ void debug_parser(Node* n, int indent)
/*** configuration process ***/
void set_configuration_option(Configuration* co, Key k, char* val)
void configuration_set_option(Configuration* co, Key k, char* val)
{
switch(k)
{
@@ -440,18 +439,18 @@ void set_configuration_option(Configuration* co, Key k, char* val)
}
}
void populate_configuration_node(Configuration* co, Node* n)
void configuration_process_node(Configuration* co, Node* n)
{
switch(n->type)
{
case N_PAIR:
Key k = n->key;
set_configuration_option(co, k, (char*)((Node*)n->value)->value);
configuration_set_option(co, k, (char*)((Node*)n->value)->value);
break;
}
}
Configuration setup_configuration(int len, Node** st)
Configuration configuration_struct_setup(int len, Node** st)
{
Configuration config;
config.compiler_path = "/usr/bin/gcc";
@@ -462,20 +461,19 @@ Configuration setup_configuration(int len, Node** st)
config.dep_searcher_flags = "-MM";
for (size_t i = 0; i < len; i++)
populate_configuration_node(&config, st[i]);
configuration_process_node(&config, st[i]);
LOG_USER("Configured IBUILD options.");
return config;
}
/*** configuration file management ***/
Configuration process_config()
{
if(!file_has_r_access(CONFIG_FILE))
{
return setup_configuration(0, NULL);
return configuration_struct_setup(0, NULL);
}
LOG_USER("IBUILD Configuration file detected.\n");
@@ -512,14 +510,12 @@ Configuration process_config()
#endif
return setup_configuration(p_count, statements);
return configuration_struct_setup(p_count, statements);
}
int main(int argc, char** argv)
{
LOG_USER("Build version: %s", VERSION);
Node** ast = NULL;
Configuration c = process_config();
launch_compile(&c);
memory_free();