1
0
mirror of https://gitlab.xiph.org/xiph/icecast-common.git synced 2024-12-04 14:46:31 -05:00

Update: Converted igloo_ro_new_raw() to include a instance parameter

This commit is contained in:
Philipp Schafft 2019-09-14 19:55:22 +00:00
parent c33ecbdcd3
commit 0606e7d475
6 changed files with 11 additions and 11 deletions

View File

@ -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.
*

View File

@ -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)

View File

@ -69,7 +69,7 @@ igloo_ro_t igloo_initialize(void)
snprintf(name, sizeof(name), "<libigloo instance %zu>", 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;

View File

@ -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];

View File

@ -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;

View File

@ -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);