From: Sebastian Harl Date: Wed, 24 Jul 2013 01:45:40 +0000 (-0700) Subject: store: Renamed sdb_store_get_host() to sdb_store_has_host(). X-Git-Tag: sysdb-0.1.0~393 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=045e522816461b58e471a6ccddf4ada51236c478;p=sysdb.git store: Renamed sdb_store_get_host() to sdb_store_has_host(). … 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. --- 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,