diff options
author | Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> | 2021-01-14 18:50:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-14 18:50:33 +0200 |
commit | cd443de780118c46dd8f02530086667d00948373 (patch) | |
tree | e29f21e28eb9eeb1d11539216a9e623ac225d3de /database/rrdlabels.c | |
parent | de6035c543296de179e359a415664106d66c3878 (diff) |
Support multiple chart label keys in data queries (#10483)
Diffstat (limited to 'database/rrdlabels.c')
-rw-r--r-- | database/rrdlabels.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/database/rrdlabels.c b/database/rrdlabels.c index b423f422a4..f9583769d5 100644 --- a/database/rrdlabels.c +++ b/database/rrdlabels.c @@ -159,6 +159,28 @@ int label_list_contains(struct label *head, struct label *check) return label_list_contains_key(head, check->key, check->key_hash); } +struct label *label_list_lookup_keylist(struct label *head, char *key) +{ + SIMPLE_PATTERN *pattern = NULL; + + pattern = simple_pattern_create(key, ",|\t\r\n\f\v", SIMPLE_PATTERN_EXACT); + + while (head != NULL) + { + if (simple_pattern_matches(pattern, head->key)) + break; + head = head->next; + } + simple_pattern_free(pattern); + return head; +} + +int label_list_contains_keylist(struct label *head, char *keylist) +{ + return (label_list_lookup_keylist(head, keylist) != NULL); +} + + /* Create a list with entries from both lists. If any entry in the low priority list is masked by an entry in the high priority list then delete it. */ |