mirror of
https://github.com/systemd/systemd.git
synced 2026-08-12 12:16:06 +00:00
report: add comment explaining that metric_startswith_prefix() does a true prefix match
This commit is contained in:
@@ -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] == '.';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user