Skip to content

Commit

Permalink
Fix varargs usage.
Browse files Browse the repository at this point in the history
Regression from leela-zero#1388. Fixes issue leela-zero#1424.

# Conflicts:
#	src/Utils.cpp
  • Loading branch information
gcp authored and ThorAvaTahr committed Aug 13, 2018
1 parent 2e55b95 commit bbf8944
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,23 @@ void Utils::myprintf(const char *fmt, ...) {
}
}

static void gtp_fprintf(FILE* file, const std::string& prefix,
const char *fmt, va_list ap) {
fprintf(file, "%s ", prefix.c_str());
vfprintf(file, fmt, ap);
fprintf(file, "\n\n");
}

static void gtp_base_printf(int id, std::string prefix,
const char *fmt, va_list ap) {
if (id != -1) {
prefix += std::to_string(id);
}
Utils::gtp_printf_raw(prefix.c_str());
Utils::gtp_printf_raw(fmt, ap);
Utils::gtp_printf_raw("\n\n");
gtp_fprintf(stdout, prefix, fmt, ap);
if (cfg_logfile_handle) {
std::lock_guard<std::mutex> lock(IOmutex);
gtp_fprintf(cfg_logfile_handle, prefix, fmt, ap);
}
}

void Utils::gtp_printf(int id, const char *fmt, ...) {
Expand Down

0 comments on commit bbf8944

Please sign in to comment.