0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2025-01-05 08:31:53 +00:00

Clearness of code of usage variable argument lists

All cases are exiting from BIRD, so the patch is a little useless,
however it will be good for copiage of this code.
This commit is contained in:
Pavel Tvrdík 2016-03-29 10:37:31 +02:00
parent e19d71a137
commit 51e8192c4c
3 changed files with 5 additions and 0 deletions

View File

@ -37,6 +37,7 @@ bug(const char *msg, ...)
fputs("Internal error: ", stderr); fputs("Internal error: ", stderr);
vlog(msg, args); vlog(msg, args);
vfprintf(stderr, msg, args); vfprintf(stderr, msg, args);
va_end(args);
exit(1); exit(1);
} }
@ -48,5 +49,6 @@ die(const char *msg, ...)
va_start(args, msg); va_start(args, msg);
cleanup(); cleanup();
vlog(msg, args); vlog(msg, args);
va_end(args);
exit(1); exit(1);
} }

View File

@ -507,6 +507,7 @@ cf_error(const char *msg, ...)
va_start(args, msg); va_start(args, msg);
if (bvsnprintf(buf, sizeof(buf), msg, args) < 0) if (bvsnprintf(buf, sizeof(buf), msg, args) < 0)
strcpy(buf, "<bug: error message too long>"); strcpy(buf, "<bug: error message too long>");
va_end(args);
new_config->err_msg = cfg_strdup(buf); new_config->err_msg = cfg_strdup(buf);
new_config->err_lino = ifs->lino; new_config->err_lino = ifs->lino;
new_config->err_file_name = ifs->file_name; new_config->err_file_name = ifs->file_name;

View File

@ -208,6 +208,7 @@ bug(const char *msg, ...)
va_start(args, msg); va_start(args, msg);
vlog(L_BUG[0], msg, args); vlog(L_BUG[0], msg, args);
va_end(args);
abort(); abort();
} }
@ -225,6 +226,7 @@ die(const char *msg, ...)
va_start(args, msg); va_start(args, msg);
vlog(L_FATAL[0], msg, args); vlog(L_FATAL[0], msg, args);
va_end(args);
exit(1); exit(1);
} }