From 68629163061ddc0fad33197a8c1eab4eb9b9cee8 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 13 Mar 2021 10:08:50 +0900 Subject: [PATCH] Avoid std::ostringstream --- src/h2load_quic.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/h2load_quic.cc b/src/h2load_quic.cc index aa7bf291..322634c1 100644 --- a/src/h2load_quic.cc +++ b/src/h2load_quic.cc @@ -34,8 +34,6 @@ #include "h2load_http3_session.h" -#include - namespace h2load { namespace { @@ -372,11 +370,15 @@ int Client::quic_init(const sockaddr *local_addr, socklen_t local_addrlen, settings.initial_ts = timestamp(worker->loop); if (!config->qlog_file_base.empty()) { assert(quic.qlog_file == nullptr); - std::ostringstream oss(config->qlog_file_base, std::ios::app); - oss << '.' << worker->id << '.' << id << ".qlog"; - quic.qlog_file = fopen(oss.str().c_str(), "w"); + auto path = config->qlog_file_base; + path += '.'; + path += util::utos(worker->id); + path += '.'; + path += util::utos(id); + path += ".qlog"; + quic.qlog_file = fopen(path.c_str(), "w"); if (quic.qlog_file == nullptr) { - std::cerr << "Failed to open a qlog file: " << oss.str() << std::endl; + std::cerr << "Failed to open a qlog file: " << path << std::endl; return -1; } settings.qlog.write = qlog_write_cb;