X-Git-Url: https://git.octo.it/?p=collectd.git;a=blobdiff_plain;f=src%2Futils_vl_lookup_test.c;h=058015edb6bd6780d28032743007196d4adae0cd;hp=2f87fdbb71263ec026e14b65a03ee584782c12de;hb=da11ce02eb202b3e01d3e2d1b40f248a84430973;hpb=2079ee1517e34de372f58e7e2267ad5c71a8a41f diff --git a/src/utils_vl_lookup_test.c b/src/utils_vl_lookup_test.c index 2f87fdbb..058015ed 100644 --- a/src/utils_vl_lookup_test.c +++ b/src/utils_vl_lookup_test.c @@ -32,8 +32,8 @@ static _Bool expect_new_obj = 0; static _Bool have_new_obj = 0; -static identifier_t last_class_ident; -static identifier_t last_obj_ident; +static lookup_identifier_t last_class_ident; +static lookup_identifier_t last_obj_ident; static data_source_t dsrc_test = {"value", DS_TYPE_DERIVE, 0.0, NAN}; static data_set_t const ds_test = {"test", 1, &dsrc_test}; @@ -43,8 +43,8 @@ static data_set_t const ds_unknown = {"unknown", 1, &dsrc_unknown}; static int lookup_obj_callback(data_set_t const *ds, value_list_t const *vl, void *user_class, void *user_obj) { - identifier_t *class = user_class; - identifier_t *obj = user_obj; + lookup_identifier_t *class = user_class; + lookup_identifier_t *obj = user_obj; OK1(expect_new_obj == have_new_obj, (expect_new_obj ? "New obj is created." : "Updating existing obj.")); @@ -53,15 +53,15 @@ static int lookup_obj_callback(data_set_t const *ds, value_list_t const *vl, memcpy(&last_obj_ident, obj, sizeof(last_obj_ident)); if (strcmp(obj->plugin_instance, "failure") == 0) - return (-1); + return -1; - return (0); + return 0; } static void *lookup_class_callback(data_set_t const *ds, value_list_t const *vl, void *user_class) { - identifier_t *class = user_class; - identifier_t *obj; + lookup_identifier_t *class = user_class; + lookup_identifier_t *obj; assert(expect_new_obj); @@ -77,7 +77,7 @@ static void *lookup_class_callback(data_set_t const *ds, value_list_t const *vl, have_new_obj = 1; - return ((void *)obj); + return (void *)obj; } static int checked_lookup_add(lookup_t *obj, /* {{{ */ @@ -85,7 +85,7 @@ static int checked_lookup_add(lookup_t *obj, /* {{{ */ char const *plugin_instance, char const *type, char const *type_instance, unsigned int group_by) { - identifier_t ident; + lookup_identifier_t ident; void *user_class; strncpy(ident.host, host, sizeof(ident.host)); @@ -107,7 +107,7 @@ static int checked_lookup_search(lookup_t *obj, char const *host, char const *plugin_instance, char const *type, char const *type_instance, _Bool expect_new) { int status; - value_list_t vl = VALUE_LIST_STATIC; + value_list_t vl = VALUE_LIST_INIT; data_set_t const *ds = &ds_unknown; strncpy(vl.host, host, sizeof(vl.host)); @@ -123,7 +123,7 @@ static int checked_lookup_search(lookup_t *obj, char const *host, have_new_obj = 0; status = lookup_search(obj, ds, &vl); - return (status); + return status; } DEF_TEST(group_by_specific_host) { @@ -142,7 +142,7 @@ DEF_TEST(group_by_specific_host) { /* expect new = */ 0); lookup_destroy(obj); - return (0); + return 0; } DEF_TEST(group_by_any_host) { @@ -170,7 +170,7 @@ DEF_TEST(group_by_any_host) { /* expect new = */ 0); lookup_destroy(obj); - return (0); + return 0; } DEF_TEST(multiple_lookups) { @@ -198,7 +198,7 @@ DEF_TEST(multiple_lookups) { assert(status == 2); lookup_destroy(obj); - return (0); + return 0; } DEF_TEST(regex) { @@ -228,7 +228,7 @@ DEF_TEST(regex) { /* expect new = */ 1); lookup_destroy(obj); - return (0); + return 0; } int main(int argc, char **argv) /* {{{ */