Skip to content

Commit fad3003

Browse files
committed
workshop/PGQueue: use libfmt
1 parent fa130a7 commit fad3003

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/workshop/PGQueue.cxx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@
66
#include "pg/Connection.hxx"
77
#include "lib/fmt/ToBuffer.hxx"
88

9+
#include <fmt/core.h>
10+
911
#include <assert.h>
1012
#include <string.h>
1113
#include <stdlib.h>
1214

15+
using std::string_view_literals::operator""sv;
16+
1317
void
1418
pg_notify(Pg::Connection &db)
1519
{
@@ -150,10 +154,11 @@ PgSetEnv(Pg::Connection &db, const char *job_id, const char *more_env)
150154
if (eq == nullptr || eq == more_env)
151155
throw std::runtime_error("Malformed environment variable");
152156

157+
const std::string_view name{more_env, eq};
158+
153159
/* for filtering out old environment variables with the same
154160
name */
155-
std::string like(more_env, eq + 1);
156-
like.push_back('%');
161+
const auto like = fmt::format("{}=%"sv, name);
157162

158163
const auto result =
159164
db.ExecuteParams("UPDATE jobs "

0 commit comments

Comments
 (0)