From f936ae212086217db0cf0c069d244b928c729126 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 22 Mar 2024 05:26:02 +0900 Subject: [PATCH] journal-gateway: use journal_add_match_pair() and add_match_boot_id() --- src/journal-remote/journal-gatewayd.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/journal-remote/journal-gatewayd.c b/src/journal-remote/journal-gatewayd.c index d88436018c..c747253858 100644 --- a/src/journal-remote/journal-gatewayd.c +++ b/src/journal-remote/journal-gatewayd.c @@ -22,6 +22,7 @@ #include "fileio.h" #include "glob-util.h" #include "hostname-util.h" +#include "journal-internal.h" #include "journal-remote.h" #include "log.h" #include "logs-show.h" @@ -460,7 +461,6 @@ static mhd_result request_parse_arguments_iterator( const char *value) { RequestMeta *m = ASSERT_PTR(cls); - _cleanup_free_ char *p = NULL; int r; if (isempty(key)) { @@ -512,7 +512,6 @@ static mhd_result request_parse_arguments_iterator( } if (r) { - char match[9 + 32 + 1] = "_BOOT_ID="; sd_id128_t bid; r = sd_id128_get_boot(&bid); @@ -521,8 +520,7 @@ static mhd_result request_parse_arguments_iterator( return MHD_NO; } - sd_id128_to_string(bid, match + 9); - r = sd_journal_add_match(m->journal, match, sizeof(match)-1); + r = add_match_boot_id(m->journal, bid); if (r < 0) { m->argument_parse_error = r; return MHD_NO; @@ -532,13 +530,7 @@ static mhd_result request_parse_arguments_iterator( return MHD_YES; } - p = strjoin(key, "=", strempty(value)); - if (!p) { - m->argument_parse_error = log_oom(); - return MHD_NO; - } - - r = sd_journal_add_match(m->journal, p, 0); + r = journal_add_match_pair(m->journal, key, strempty(value)); if (r < 0) { m->argument_parse_error = r; return MHD_NO; -- 2.25.1