From 65bd8aab5437d4c8fe98b63c09adfba4093346ba Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Thu, 1 Nov 2007 01:39:13 +0100 Subject: [PATCH] src/utils_threshold.[ch]: Added the header file and initialize the AVL tree. --- src/utils_threshold.c | 10 ++++++++++ src/utils_threshold.h | 30 ++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/utils_threshold.h diff --git a/src/utils_threshold.c b/src/utils_threshold.c index b036f993..03bc4233 100644 --- a/src/utils_threshold.c +++ b/src/utils_threshold.c @@ -349,6 +349,16 @@ int ut_config (const oconfig_item_t *ci) threshold_t th; + if (threshold_tree == NULL) + { + threshold_tree = avl_create ((void *) strcmp); + if (threshold_tree == NULL) + { + ERROR ("ut_config: avl_create failed."); + return (-1); + } + } + memset (&th, '\0', sizeof (th)); th.min = NAN; th.max = NAN; diff --git a/src/utils_threshold.h b/src/utils_threshold.h new file mode 100644 index 00000000..6f7d47e2 --- /dev/null +++ b/src/utils_threshold.h @@ -0,0 +1,30 @@ +/** + * collectd - src/utils_threshold.h + * Copyright (C) 2007 Florian octo Forster + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; only version 2 of the License is applicable. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Author: + * Florian octo Forster + **/ + +#ifndef UTILS_THRESHOLD_H +#define UTILS_THRESHOLD_H 1 + +#include "collectd.h" +#include "liboconfig/oconfig.h" + +int ut_config (const oconfig_item_t *ci); + +#endif /* UTILS_THRESHOLD_H */ -- 2.30.2