Removed magic numbers.

This commit is contained in:
Markus Makela
2015-09-01 11:59:37 +03:00
parent e839dafdd0
commit 77a49e8cbd
2 changed files with 8 additions and 8 deletions

View File

@ -318,14 +318,14 @@ int rval, ini_rval;
{ {
char errorbuffer[1024 + 1]; char errorbuffer[1024 + 1];
if(ini_rval > 0) if (ini_rval > 0)
snprintf(errorbuffer, 1024, snprintf(errorbuffer, sizeof(errorbuffer),
"Error: Failed to parse configuration file. Error on line %d.", ini_rval); "Error: Failed to parse configuration file. Error on line %d.", ini_rval);
else if(ini_rval == -1) else if(ini_rval == -1)
snprintf(errorbuffer, 1024, snprintf(errorbuffer, sizeof(errorbuffer),
"Error: Failed to parse configuration file. Failed to open file."); "Error: Failed to parse configuration file. Failed to open file.");
else else
snprintf(errorbuffer, 1024, snprintf(errorbuffer, sizeof(errorbuffer),
"Error: Failed to parse configuration file. Memory allocation failed."); "Error: Failed to parse configuration file. Memory allocation failed.");
skygw_log_write(LE, errorbuffer); skygw_log_write(LE, errorbuffer);

View File

@ -1594,16 +1594,16 @@ int main(int argc, char **argv)
if((ini_rval = ini_parse(cnf_file_path, cnf_preparser,NULL)) != 0) if((ini_rval = ini_parse(cnf_file_path, cnf_preparser,NULL)) != 0)
{ {
char errorbuffer[STRING_BUFFER_SIZE + 1]; char errorbuffer[STRING_BUFFER_SIZE];
if(ini_rval > 0) if(ini_rval > 0)
snprintf(errorbuffer, STRING_BUFFER_SIZE, snprintf(errorbuffer, sizeof(errorbuffer),
"Error: Failed to pre-parse configuration file. Error on line %d.", ini_rval); "Error: Failed to pre-parse configuration file. Error on line %d.", ini_rval);
else if(ini_rval == -1) else if(ini_rval == -1)
snprintf(errorbuffer, STRING_BUFFER_SIZE, snprintf(errorbuffer, sizeof(errorbuffer),
"Error: Failed to pre-parse configuration file. Failed to open file."); "Error: Failed to pre-parse configuration file. Failed to open file.");
else else
snprintf(errorbuffer, STRING_BUFFER_SIZE, snprintf(errorbuffer, sizeof(errorbuffer),
"Error: Failed to pre-parse configuration file. Memory allocation failed."); "Error: Failed to pre-parse configuration file. Memory allocation failed.");
skygw_log_write(LE, errorbuffer); skygw_log_write(LE, errorbuffer);