- /* Copy percentiles configuration */
- dst->percentile_num = src.percentile_num;
- dst->percentile = calloc(src.percentile_num, sizeof(*dst->percentile));
- if (dst->percentile == NULL)
- return (-1);
-
- memcpy(dst->percentile, src.percentile,
- (sizeof(*dst->percentile) * (src.percentile_num)));
-
- if (src.percentile_type != NULL)
- {
- dst->percentile_type = strdup(src.percentile_type);
- if (dst->percentile_type == NULL)
- {
- latency_config_free(*dst);
- return (-1);
- }
+ for (int i = 0; i < ci->children_num; i++) {
+ oconfig_item_t *child = ci->children + i;
+
+ if (strcasecmp("Percentile", child->key) == 0)
+ status = latency_config_add_percentile(conf, child, plugin);
+ else if (strcasecmp("Bucket", child->key) == 0)
+ status = latency_config_add_bucket(conf, child, plugin);
+ else
+ WARNING("%s plugin: \"%s\" is not a valid option within a \"%s\" block.",
+ plugin, child->key, ci->key);
+
+ if (status != 0)
+ return status;