From b01dfa2c83158c2d4b2fcdb1f1c91ebf827f8233 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 19 Feb 2026 08:47:51 +0100 Subject: [PATCH] report: add comment explaining that metric_startswith_prefix() does a true prefix match --- src/report/report.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/report/report.c b/src/report/report.c index e038d4fa5b9..ab13ae905bf 100644 --- a/src/report/report.c +++ b/src/report/report.c @@ -103,6 +103,9 @@ static inline bool metric_startswith_prefix(const char *metric_name, const char if (isempty(metric_name) || isempty(prefix)) return false; + /* NB: this checks for a *true* prefix, i.e. insists on the dot separator after the prefix. Or in + * other words, "foo" is not going to be considered a prefix of "foo", but of "foo.bar" it will. */ + const char *m = startswith(metric_name, prefix); return !isempty(m) && m[0] == '.'; } -- 2.47.3