aboutsummaryrefslogtreecommitdiff
path: root/src/util.cpp
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2018-11-20 20:43:57 -0500
committerDeterminant <[email protected]>2018-11-20 20:43:57 -0500
commitd2fe5eb74bdf40afc5cacd052f40b56aa3e57eaf (patch)
tree30e042013d87d10cf9e0db95fd9398878b305915 /src/util.cpp
parent60c4af2602e18933f2b795500f44c6613c852f45 (diff)
refactor libuv wrapper classes
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/util.cpp b/src/util.cpp
index c51e191..6a8c652 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -51,11 +51,13 @@ double gen_rand_timeout(double base_timeout, double alpha) {
return base_timeout + rand() / (double)RAND_MAX * alpha * base_timeout;
}
-std::string vstringprintf(const char *fmt, va_list ap) {
+std::string vstringprintf(const char *fmt, va_list _ap) {
int guessed_size = 1024;
std::string buff;
+ va_list ap;
+ va_copy(ap, _ap);
buff.resize(guessed_size);
- int nwrote = vsnprintf(&buff[0], guessed_size, fmt, ap);
+ int nwrote = vsnprintf(&buff[0], guessed_size, fmt, _ap);
if (nwrote < 0) buff = "";
else
{
@@ -66,6 +68,7 @@ std::string vstringprintf(const char *fmt, va_list ap) {
buff = "";
}
}
+ va_end(ap);
return std::move(buff);
}