Merge branch 'tb/trace2-va-list-fix'

Fix some code that passed a NULL when a va_list was expected.

* tb/trace2-va-list-fix:
  trace2: NULL is not allowed for va_list
This commit is contained in:
Junio C Hamano 2019-04-16 19:28:10 +09:00
commit e9bd21c337
5 changed files with 16 additions and 9 deletions

View file

@ -548,10 +548,14 @@ void trace2_region_enter_printf_va_fl(const char *file, int line,
}
void trace2_region_enter_fl(const char *file, int line, const char *category,
const char *label, const struct repository *repo)
const char *label, const struct repository *repo, ...)
{
va_list ap;
va_start(ap, repo);
trace2_region_enter_printf_va_fl(file, line, category, label, repo,
NULL, NULL);
NULL, ap);
va_end(ap);
}
void trace2_region_enter_printf_fl(const char *file, int line,
@ -621,10 +625,13 @@ void trace2_region_leave_printf_va_fl(const char *file, int line,
}
void trace2_region_leave_fl(const char *file, int line, const char *category,
const char *label, const struct repository *repo)
const char *label, const struct repository *repo, ...)
{
va_list ap;
va_start(ap, repo);
trace2_region_leave_printf_va_fl(file, line, category, label, repo,
NULL, NULL);
NULL, ap);
va_end(ap);
}
void trace2_region_leave_printf_fl(const char *file, int line,

View file

@ -238,7 +238,7 @@ void trace2_def_repo_fl(const char *file, int line, struct repository *repo);
* on this thread.
*/
void trace2_region_enter_fl(const char *file, int line, const char *category,
const char *label, const struct repository *repo);
const char *label, const struct repository *repo, ...);
#define trace2_region_enter(category, label, repo) \
trace2_region_enter_fl(__FILE__, __LINE__, (category), (label), (repo))
@ -278,7 +278,7 @@ void trace2_region_enter_printf(const char *category, const char *label,
* in this nesting level.
*/
void trace2_region_leave_fl(const char *file, int line, const char *category,
const char *label, const struct repository *repo);
const char *label, const struct repository *repo, ...);
#define trace2_region_leave(category, label, repo) \
trace2_region_leave_fl(__FILE__, __LINE__, (category), (label), (repo))

View file

@ -190,7 +190,7 @@ static void fn_atexit(uint64_t us_elapsed_absolute, int code)
static void maybe_add_string_va(struct json_writer *jw, const char *field_name,
const char *fmt, va_list ap)
{
if (fmt && *fmt && ap) {
if (fmt && *fmt) {
va_list copy_ap;
struct strbuf buf = STRBUF_INIT;

View file

@ -126,7 +126,7 @@ static void fn_atexit(uint64_t us_elapsed_absolute, int code)
static void maybe_append_string_va(struct strbuf *buf, const char *fmt,
va_list ap)
{
if (fmt && *fmt && ap) {
if (fmt && *fmt) {
va_list copy_ap;
va_copy(copy_ap, ap);

View file

@ -211,7 +211,7 @@ static void fn_atexit(uint64_t us_elapsed_absolute, int code)
static void maybe_append_string_va(struct strbuf *buf, const char *fmt,
va_list ap)
{
if (fmt && *fmt && ap) {
if (fmt && *fmt) {
va_list copy_ap;
va_copy(copy_ap, ap);