rename replace to replace_once

This commit is contained in:
2026-01-11 20:50:49 +01:00
parent cf3b502509
commit 2c8b9f2cfc

View File

@@ -3,8 +3,8 @@
#include <sstream> #include <sstream>
#include <string> #include <string>
static bool replace(std::string &str, const std::string &from, static bool replace_once(std::string &str, const std::string &from,
const std::string &to) { const std::string &to) {
size_t start_pos = str.find(from); size_t start_pos = str.find(from);
if (start_pos == std::string::npos) if (start_pos == std::string::npos)
return false; return false;
@@ -23,7 +23,7 @@ std::string inject_html_into_template(const std::string &FILE_NAME,
std::ostringstream ss; std::ostringstream ss;
ss << file.rdbuf(); ss << file.rdbuf();
result = ss.str(); result = ss.str();
if (replace(result, TEMPLATE, HTML)) { if (replace_once(result, TEMPLATE, HTML)) {
return result; return result;
} }
return ""; return "";