+ {
+ static char type[DATA_MAX_NAME_LEN] = "!!!invalid!!!";
+
+ assert (key->type != NULL);
+ if (strcmp (type, key->type) != 0)
+ {
+ ERROR ("curl_json plugin: Unable to look up DS type \"%s\".",
+ key->type);
+ sstrncpy (type, key->type, sizeof (type));
+ }
+
+ return -1;
+ }
+ else if (ds->ds_num > 1)
+ {
+ static c_complain_t complaint = C_COMPLAIN_INIT_STATIC;
+
+ c_complain_once (LOG_WARNING, &complaint,
+ "curl_json plugin: The type \"%s\" has more than one data source. "
+ "This is currently not supported. I will return the type of the "
+ "first data source, but this will likely lead to problems later on.",
+ key->type);
+ }
+
+ return ds->ds[0].type;
+}
+
+static int cj_cb_map_key (void *ctx, const unsigned char *val,
+ yajl_len_t len);
+
+static void cj_cb_inc_array_index (void *ctx, _Bool update_key)
+{
+ cj_t *db = (cj_t *)ctx;
+
+ if (!db->state[db->depth].in_array)
+ return;
+
+ db->state[db->depth].index++;
+
+ if (update_key)
+ {
+ char name[DATA_MAX_NAME_LEN];
+
+ ssnprintf (name, sizeof (name), "%d", db->state[db->depth].index - 1);
+
+ cj_cb_map_key (ctx, (unsigned char *)name, (yajl_len_t) strlen (name));
+ }