From ed569e21915fe71ead292582a8699d25234cf303 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Thu, 26 Jun 2014 22:27:31 +0200 Subject: [PATCH] store: Renamed a store object's 'children' to 'services'. Hierarchical data will be represented using some object relationship information rather than a weird tree construct below each host. That's going to be more flexible. --- src/core/store-private.h | 2 +- src/core/store.c | 14 +++++++------- src/core/store_lookup.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/core/store-private.h b/src/core/store-private.h index 7cc2f66..e501b2c 100644 --- a/src/core/store-private.h +++ b/src/core/store-private.h @@ -66,7 +66,7 @@ typedef struct { typedef struct { sdb_store_base_t super; - sdb_llist_t *children; + sdb_llist_t *services; sdb_llist_t *attributes; } sdb_store_obj_t; #define SDB_STORE_OBJ(obj) ((sdb_store_obj_t *)(obj)) diff --git a/src/core/store.c b/src/core/store.c index df8c02f..4e642de 100644 --- a/src/core/store.c +++ b/src/core/store.c @@ -92,8 +92,8 @@ sdb_store_obj_init(sdb_object_t *obj, va_list ap) if (ret) return ret; - sobj->children = sdb_llist_create(); - if (! sobj->children) + sobj->services = sdb_llist_create(); + if (! sobj->services) return -1; sobj->attributes = sdb_llist_create(); if (! sobj->attributes) @@ -110,8 +110,8 @@ sdb_store_obj_destroy(sdb_object_t *obj) store_base_destroy(obj); - if (sobj->children) - sdb_llist_destroy(sobj->children); + if (sobj->services) + sdb_llist_destroy(sobj->services); if (sobj->attributes) sdb_llist_destroy(sobj->attributes); } /* sdb_store_obj_destroy */ @@ -188,7 +188,7 @@ store_lookup_in_list(sdb_llist_t *l, int type, const char *name) if ((type != SDB_HOST) && (STORE_BASE(sobj)->type == SDB_HOST)) continue; - sobj = store_lookup_in_list(sobj->children, type, name); + sobj = store_lookup_in_list(sobj->services, type, name); if (sobj) { sdb_llist_iter_destroy(iter); return sobj; @@ -269,7 +269,7 @@ store_obj(int parent_type, const char *parent_name, if (type == SDB_ATTRIBUTE) parent_list = parent->attributes; else - parent_list = parent->children; + parent_list = parent->services; } if (type == SDB_HOST) @@ -543,7 +543,7 @@ sdb_store_host_tojson(sdb_store_base_t *h, sdb_strbuf_t *buf, int flags) if (! (flags & SDB_SKIP_SERVICES)) { sdb_strbuf_append(buf, ", \"services\": "); - store_obj_tojson(host->children, SDB_SERVICE, buf); + store_obj_tojson(host->services, SDB_SERVICE, buf); } sdb_strbuf_append(buf, "}"); diff --git a/src/core/store_lookup.c b/src/core/store_lookup.c index 3920b80..f57cb05 100644 --- a/src/core/store_lookup.c +++ b/src/core/store_lookup.c @@ -172,7 +172,7 @@ match_name(sdb_store_matcher_t *m, sdb_store_base_t *obj) return match_string(&NAME_M(m)->name, obj->super.name); break; case SDB_SERVICE: - iter = sdb_llist_get_iter(SDB_STORE_OBJ(obj)->children); + iter = sdb_llist_get_iter(SDB_STORE_OBJ(obj)->services); break; case SDB_ATTRIBUTE: iter = sdb_llist_get_iter(SDB_STORE_OBJ(obj)->attributes); -- 2.30.2