removed stupid goto in logger

This commit is contained in:
Václav Šmejkal 2024-02-19 12:17:44 +01:00
parent e77937e69e
commit b6bace31e2
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -71,10 +71,8 @@ why2_log_file why2_init_logger(char *directoryPath)
if (buffer > WHY2_MAX_USAGE) //WHY2_MAX_USAGE WAS REACHED if (buffer > WHY2_MAX_USAGE) //WHY2_MAX_USAGE WAS REACHED
{ {
file = INVALID_FILE; file = INVALID_FILE;
} else
goto deallocation; {
}
sprintf(filePath, WHY2_LOG_FORMATTING, directoryPath, dateBuffer, buffer); //GENERATE LOG-NAME sprintf(filePath, WHY2_LOG_FORMATTING, directoryPath, dateBuffer, buffer); //GENERATE LOG-NAME
file = open(filePath, O_RDWR | O_APPEND | O_CREAT, 0644); //CREATE LOG FILE file = open(filePath, O_RDWR | O_APPEND | O_CREAT, 0644); //CREATE LOG FILE
@ -94,8 +92,7 @@ why2_log_file why2_init_logger(char *directoryPath)
why2_clean_memory("logger_logfile_init"); why2_clean_memory("logger_logfile_init");
return why2_empty_log_file(); return why2_empty_log_file();
} }
}
deallocation:
//DEALLOCATION //DEALLOCATION
why2_deallocate(dateBuffer); why2_deallocate(dateBuffer);