From 045e522816461b58e471a6ccddf4ada51236c478 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Tue, 23 Jul 2013 18:45:40 -0700 Subject: [PATCH] store: Renamed sdb_store_get_host() to sdb_store_has_host(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit … and make the function return a boolean value. We don't currently need a function to access the actual host object. So, don't expose it that way. --- src/backend/collectd/unixsock.c | 2 +- src/core/store.c | 10 ++++------ src/include/core/store.h | 4 ++-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/backend/collectd/unixsock.c b/src/backend/collectd/unixsock.c index 7e4f73a..762539c 100644 --- a/src/backend/collectd/unixsock.c +++ b/src/backend/collectd/unixsock.c @@ -145,7 +145,7 @@ sdb_collectd_get_data(sdb_unixsock_client_t __attribute__((unused)) *client, return -1; } - if (! sdb_store_get_host(hostname)) + if (! sdb_store_has_host(hostname)) sdb_collectd_add_host(hostname, last_update); if (sdb_collectd_add_svc(hostname, plugin, type, last_update)) diff --git a/src/core/store.c b/src/core/store.c index a5f712e..b933581 100644 --- a/src/core/store.c +++ b/src/core/store.c @@ -310,8 +310,8 @@ sdb_store_host(const char *name, sdb_time_t last_update) return status; } /* sdb_store_host */ -const sdb_host_t * -sdb_store_get_host(const char *name) +_Bool +sdb_store_has_host(const char *name) { sdb_host_t *host; @@ -319,10 +319,8 @@ sdb_store_get_host(const char *name) return NULL; host = SDB_HOST(sdb_llist_search_by_name(host_list, name)); - if (! host) - return NULL; - return host; -} /* sdb_store_get_host */ + return host != NULL; +} /* sdb_store_has_host */ sdb_attribute_t * sdb_attribute_create(const char *hostname, diff --git a/src/include/core/store.h b/src/include/core/store.h index 563bd1a..aac884a 100644 --- a/src/include/core/store.h +++ b/src/include/core/store.h @@ -101,8 +101,8 @@ typedef struct { int sdb_store_host(const char *name, sdb_time_t last_update); -const sdb_host_t * -sdb_store_get_host(const char *name); +_Bool +sdb_store_has_host(const char *name); sdb_attribute_t * sdb_attribute_create(const char *hostname, -- 2.30.2