From 0606e7d475314646ee4564985fb428de08672766 Mon Sep 17 00:00:00 2001 From: Philipp Schafft Date: Sat, 14 Sep 2019 19:55:22 +0000 Subject: [PATCH] Update: Converted igloo_ro_new_raw() to include a instance parameter --- include/igloo/logmsg.h | 2 +- include/igloo/ro.h | 2 +- src/libigloo.c | 2 +- src/logmsg.c | 4 ++-- src/reportxml.c | 4 ++-- src/tests/ctest_logmsg.c | 8 ++++---- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/igloo/logmsg.h b/include/igloo/logmsg.h index c643817..445a42c 100644 --- a/include/igloo/logmsg.h +++ b/include/igloo/logmsg.h @@ -105,7 +105,7 @@ typedef unsigned long int igloo_logmsg_opt_t; * ... * Parameters according to the format string. */ -igloo_logmsg_t * igloo_logmsg_new(const char *name, igloo_ro_t associated, const char *msgid, const char *cat, const char *func, const char *codefile, const ssize_t codeline, const struct timespec * ts, igloo_loglevel_t level, igloo_logmsg_opt_t options, igloo_list_t *referenced, const char *format, ...); +igloo_logmsg_t * igloo_logmsg_new(const char *name, igloo_ro_t associated, igloo_ro_t instance, const char *msgid, const char *cat, const char *func, const char *codefile, const ssize_t codeline, const struct timespec * ts, igloo_loglevel_t level, igloo_logmsg_opt_t options, igloo_list_t *referenced, const char *format, ...); /* Get the context from a log message object. * diff --git a/include/igloo/ro.h b/include/igloo/ro.h index 39eb562..b0bac7f 100644 --- a/include/igloo/ro.h +++ b/include/igloo/ro.h @@ -288,7 +288,7 @@ int igloo_RO_HAS_TYPE_raw(igloo_ro_t object, const igloo_ro_type_t * */ igloo_ro_t igloo_ro_new__raw(const igloo_ro_type_t *type, const char *name, igloo_ro_t associated, igloo_ro_t instance); -#define igloo_ro_new_raw(type, name, associated) igloo_RO_TO_TYPE(igloo_ro_new__raw(igloo_RO_GET_TYPE_BY_SYMBOL(type), (name), (associated), igloo_RO_NULL), type) +#define igloo_ro_new_raw(type, name, associated, instance) igloo_RO_TO_TYPE(igloo_ro_new__raw(igloo_RO_GET_TYPE_BY_SYMBOL(type), (name), (associated), (instance)), type) igloo_ro_t igloo_ro_new__simple(const igloo_ro_type_t *type, const char *name, igloo_ro_t associated, igloo_ro_t instance, ...); #define igloo_ro_new(type, ...) igloo_RO_TO_TYPE(igloo_ro_new__simple(igloo_RO_GET_TYPE_BY_SYMBOL(type), NULL, igloo_RO_NULL, igloo_RO_NULL, ## __VA_ARGS__), type) diff --git a/src/libigloo.c b/src/libigloo.c index 94be2d0..04ca615 100644 --- a/src/libigloo.c +++ b/src/libigloo.c @@ -69,7 +69,7 @@ igloo_ro_t igloo_initialize(void) snprintf(name, sizeof(name), "", igloo_initialize__refc); - ret = igloo_ro_new_raw(igloo_instance_t, name, igloo_RO_NULL); + ret = igloo_ro_new_raw(igloo_instance_t, name, igloo_RO_NULL, igloo_RO_NULL); if (!ret) return igloo_RO_NULL; diff --git a/src/logmsg.c b/src/logmsg.c index adf418f..9588071 100644 --- a/src/logmsg.c +++ b/src/logmsg.c @@ -54,7 +54,7 @@ igloo_RO_PUBLIC_TYPE(igloo_logmsg_t, ); -igloo_logmsg_t * igloo_logmsg_new(const char *name, igloo_ro_t associated, +igloo_logmsg_t * igloo_logmsg_new(const char *name, igloo_ro_t associated, igloo_ro_t instance, const char *msgid, const char *cat, const char *func, const char *codefile, const ssize_t codeline, @@ -63,7 +63,7 @@ igloo_logmsg_t * igloo_logmsg_new(const char *name, igloo_ro_t associated, igloo_list_t *referenced, const char *format, ...) { - igloo_logmsg_t *logmsg = igloo_ro_new_raw(igloo_logmsg_t, name, associated); + igloo_logmsg_t *logmsg = igloo_ro_new_raw(igloo_logmsg_t, name, associated, instance); va_list ap; char string[LOG_MAXLINELEN]; diff --git a/src/reportxml.c b/src/reportxml.c index ca3b0c7..9c06c33 100644 --- a/src/reportxml.c +++ b/src/reportxml.c @@ -274,7 +274,7 @@ static igloo_reportxml_t * reportxml_new_with_root(igloo_reportxml_node_t *ro if (!root) return NULL; - ret = igloo_ro_new_raw(igloo_reportxml_t, NULL, igloo_RO_NULL); + ret = igloo_ro_new_raw(igloo_reportxml_t, NULL, igloo_RO_NULL, root); if (!ret) return NULL; @@ -393,7 +393,7 @@ igloo_reportxml_node_t * igloo_reportxml_node_new(igloo_reportxml_node_type if (!nodedef) return NULL; - ret = igloo_ro_new_raw(igloo_reportxml_node_t, NULL, igloo_RO_NULL); + ret = igloo_ro_new_raw(igloo_reportxml_node_t, NULL, igloo_RO_NULL, igloo_RO_NULL); if (ret == NULL) return NULL; diff --git a/src/tests/ctest_logmsg.c b/src/tests/ctest_logmsg.c index 02d44be..26f5d89 100644 --- a/src/tests/ctest_logmsg.c +++ b/src/tests/ctest_logmsg.c @@ -24,7 +24,7 @@ static void test_create_unref(void) igloo_objecthandler_t *formater; igloo_filter_t *filter; - msg = igloo_logmsg_new(NULL, igloo_RO_NULL, NULL, NULL, NULL, NULL, -1, NULL, igloo_LOGLEVEL__NONE, igloo_LOGMSG_OPT_NONE, NULL, "test"); + msg = igloo_logmsg_new(NULL, igloo_RO_NULL, igloo_RO_NULL, NULL, NULL, NULL, NULL, -1, NULL, igloo_LOGLEVEL__NONE, igloo_LOGMSG_OPT_NONE, NULL, "test"); ctest_test("logmsg created", !igloo_RO_IS_NULL(msg)); ctest_test("un-referenced", igloo_ro_unref(msg) == igloo_ERROR_NONE); @@ -49,7 +49,7 @@ static void test_logmsg(void) igloo_list_t *referenced_out; int ret; - msg = igloo_logmsg_new("name", igloo_RO_NULL, "msgid", "cat", "func", "codefile", 13374242, &tv_in, igloo_LOGLEVEL_INFO, igloo_LOGMSG_OPT_ASKACK, NULL, "test %i %s", 5, "msg"); + msg = igloo_logmsg_new("name", igloo_RO_NULL, igloo_RO_NULL, "msgid", "cat", "func", "codefile", 13374242, &tv_in, igloo_LOGLEVEL_INFO, igloo_LOGMSG_OPT_ASKACK, NULL, "test %i %s", 5, "msg"); ctest_test("logmsg created", !igloo_RO_IS_NULL(msg)); ctest_test("got context", (ret = igloo_logmsg_get_context(msg, &msgid_out, &cat_out, &func_out, &codefile_out, &codeline_out, &tv_out)) == 0); @@ -104,12 +104,12 @@ static void test_filter(void) ctest_test("droping base", igloo_filter_test(filter, base) == igloo_FILTER_RESULT_DROP); ctest_test("base un-referenced", igloo_ro_unref(base) == igloo_ERROR_NONE); - msg = igloo_logmsg_new(NULL, igloo_RO_NULL, NULL, NULL, NULL, NULL, -1, NULL, igloo_LOGLEVEL_INFO, igloo_LOGMSG_OPT_NONE, NULL, "test"); + msg = igloo_logmsg_new(NULL, igloo_RO_NULL, igloo_RO_NULL, NULL, NULL, NULL, NULL, -1, NULL, igloo_LOGLEVEL_INFO, igloo_LOGMSG_OPT_NONE, NULL, "test"); ctest_test("logmsg created", !igloo_RO_IS_NULL(msg)); ctest_test("droping logmsg", igloo_filter_test(filter, msg) == igloo_FILTER_RESULT_DROP); ctest_test("un-referenced", igloo_ro_unref(msg) == igloo_ERROR_NONE); - msg = igloo_logmsg_new(NULL, igloo_RO_NULL, NULL, NULL, NULL, NULL, -1, NULL, igloo_LOGLEVEL_WARN, igloo_LOGMSG_OPT_NONE, NULL, "test"); + msg = igloo_logmsg_new(NULL, igloo_RO_NULL, igloo_RO_NULL, NULL, NULL, NULL, NULL, -1, NULL, igloo_LOGLEVEL_WARN, igloo_LOGMSG_OPT_NONE, NULL, "test"); ctest_test("logmsg created", !igloo_RO_IS_NULL(msg)); ctest_test("passing logmsg", igloo_filter_test(filter, msg) == igloo_FILTER_RESULT_PASS); ctest_test("un-referenced", igloo_ro_unref(msg) == igloo_ERROR_NONE);