Skip to content

Commit

Permalink
tests: in_podman_metrics: update check_metric to use cfl_list. (#8844)
Browse files Browse the repository at this point in the history
refactor check_metric to use cfl_list API to iterate counters.

Signed-off-by: Phillip Whelan <[email protected]>
  • Loading branch information
pwhelan authored May 21, 2024
1 parent cc49ac9 commit 89a343b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tests/runtime/in_podman_metrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
#define DPATH_PODMAN_CGROUP_V2 FLB_TESTS_DATA_PATH "/data/podman/cgroupv2"


int check_metric(flb_ctx_t *ctx, flb_sds_t *name) {
int check_metric(flb_ctx_t *ctx, const char *name) {
struct mk_list *tmp;
struct mk_list *head;
struct mk_list *inner_tmp;
struct mk_list *inner_head;
struct cfl_list *inner_tmp;
struct cfl_list *inner_head;

struct flb_input_instance *i_ins;
struct cmt_counter *counter;
Expand All @@ -43,8 +43,8 @@ int check_metric(flb_ctx_t *ctx, flb_sds_t *name) {

mk_list_foreach_safe(head, tmp, &ctx->config->inputs) {
i_ins = mk_list_entry(head, struct flb_input_instance, _head);
mk_list_foreach_safe(inner_head, inner_tmp, &i_ins->cmt->counters) {
counter = mk_list_entry(inner_head, struct cmt_counter, _head);
cfl_list_foreach_safe(inner_head, inner_tmp, &i_ins->cmt->counters) {
counter = cfl_list_entry(inner_head, struct cmt_counter, _head);

if (strlen(name) != 0 && strcmp(name, counter->opts.name) == 0)
{
Expand Down

0 comments on commit 89a343b

Please sign in to comment.