]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
format_json: Rename "label_t" to "keyval_t" in test.
authorFlorian Forster <octo@google.com>
Fri, 17 Jul 2020 08:36:52 +0000 (10:36 +0200)
committerFlorian Forster <octo@google.com>
Tue, 21 Jul 2020 15:30:10 +0000 (17:30 +0200)
This is to avoid a name clash with the type defined in "metric.h".

src/utils/format_json/format_json_test.c

index 30c89bb584f0be555b28416dda596e7f66daed0c..ad735e449c193c5418c1eaa757957ffc928e8252 100644 (file)
  *   Florian octo Forster <octo at collectd.org>
  */
 
-/* Workaround for Solaris 10 defining label_t
- * Issue #1301
- */
-
-#include "config.h"
-#if KERNEL_SOLARIS
-#ifndef _POSIX_C_SOURCE
-#define _POSIX_C_SOURCE 200112L
-#endif
-#undef __EXTENSIONS__
-#endif
-
 #include "collectd.h"
 
 #include "testing.h"
 typedef struct {
   char const *key;
   char const *value;
-} label_t;
+} keyval_t;
 
 typedef struct {
-  label_t *expected_labels;
+  keyval_t *expected_labels;
   size_t expected_labels_num;
 
-  label_t *current_label;
+  keyval_t *current_label;
 } test_case_t;
 
 #if HAVE_YAJL_V2
@@ -75,7 +63,7 @@ static int test_map_key(void *ctx, unsigned char const *key,
 
   c->current_label = NULL;
   for (i = 0; i < c->expected_labels_num; i++) {
-    label_t *l = c->expected_labels + i;
+    keyval_t *l = c->expected_labels + i;
     if ((strlen(l->key) == key_len) &&
         (strncmp(l->key, (char const *)key, key_len) == 0)) {
       c->current_label = l;
@@ -110,7 +98,7 @@ static int test_string(void *ctx, unsigned char const *value,
   test_case_t *c = ctx;
 
   if (c->current_label != NULL) {
-    label_t *l = c->current_label;
+    keyval_t *l = c->current_label;
     char *got;
     int status;
 
@@ -129,7 +117,7 @@ static int test_string(void *ctx, unsigned char const *value,
   return 1; /* continue */
 }
 
-static int expect_json_labels(char *json, label_t *labels, size_t labels_num) {
+static int expect_json_labels(char *json, keyval_t *labels, size_t labels_num) {
   yajl_callbacks funcs = {
       .yajl_string = test_string,
       .yajl_map_key = test_map_key,
@@ -151,7 +139,7 @@ static int expect_json_labels(char *json, label_t *labels, size_t labels_num) {
 }
 
 DEF_TEST(notification) {
-  label_t labels[] = {
+  keyval_t labels[] = {
       {"summary", "this is a message"},
       {"alertname", "collectd_unit_test"},
       {"instance", "example.com"},