Avoid needlessly constructing a temporary string

This commit is contained in:
Eric Fischer
2016-04-28 12:46:40 -07:00
parent 444de1f086
commit f75d9e0dd4
+2 -2
View File
@@ -102,7 +102,7 @@ static void quote(std::string *buf, const char *s) {
} }
*out = '\0'; *out = '\0';
buf->append(std::string(tmp)); buf->append(tmp, strlen(tmp));
} }
static void aprintf(std::string *buf, const char *format, ...) { static void aprintf(std::string *buf, const char *format, ...) {
@@ -116,7 +116,7 @@ static void aprintf(std::string *buf, const char *format, ...) {
} }
va_end(ap); va_end(ap);
buf->append(std::string(tmp)); buf->append(tmp, strlen(tmp));
free(tmp); free(tmp);
} }