From 8bb05ac73a5b448b339ce0bc8d396c82c459b47f Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 21:33:32 +0200 Subject: Merging upstream version 2.40. Signed-off-by: Daniel Baumann --- misc-utils/lsfd-counter.c | 56 ----------------------------------------------- 1 file changed, 56 deletions(-) delete mode 100644 misc-utils/lsfd-counter.c (limited to 'misc-utils/lsfd-counter.c') diff --git a/misc-utils/lsfd-counter.c b/misc-utils/lsfd-counter.c deleted file mode 100644 index 55f0fde..0000000 --- a/misc-utils/lsfd-counter.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * lsfd-counter.c - counter implementation used in --summary option - * - * Copyright (C) 2021 Red Hat, Inc. - * Copyright (C) 2021 Masatake YAMATO - * - * This file may be redistributed under the terms of the - * GNU Lesser General Public License. - */ - -#include "lsfd-counter.h" - -#include "xalloc.h" - -struct lsfd_counter { - char *name; - size_t value; - struct lsfd_filter *filter; -}; - -struct lsfd_counter *lsfd_counter_new(const char *const name, struct lsfd_filter *filter) -{ - struct lsfd_counter *counter = xmalloc(sizeof(struct lsfd_counter)); - - counter->name = xstrdup(name); - counter->value = 0; - counter->filter = filter; - - return counter; -} - -void lsfd_counter_free(struct lsfd_counter *counter) -{ - lsfd_filter_free(counter->filter); - free(counter->name); - free(counter); -} - -bool lsfd_counter_accumulate(struct lsfd_counter *counter, struct libscols_line *ln) -{ - if (lsfd_filter_apply(counter->filter, ln)) { - counter->value++; - return true; - } - return false; -} - -const char *lsfd_counter_name(struct lsfd_counter *counter) -{ - return counter->name; -} - -size_t lsfd_counter_value(struct lsfd_counter *counter) -{ - return counter->value; -} -- cgit v1.2.3