if ((r == NULL) || (prep_area == NULL))
return -EINVAL;
+#if COLLECT_DEBUG
+ assert(prep_area->ds == NULL);
+ assert(prep_area->instances_pos == NULL);
+ assert(prep_area->values_pos == NULL);
+ assert(prep_area->metadata_pos == NULL);
+ assert(prep_area->instances_buffer == NULL);
+ assert(prep_area->values_buffer == NULL);
+ assert(prep_area->metadata_buffer == NULL);
+#endif
+
#define BAIL_OUT(status) \
- prep_area->ds = NULL; \
- sfree(prep_area->instances_pos); \
- sfree(prep_area->values_pos); \
- sfree(prep_area->metadata_pos); \
- sfree(prep_area->instances_buffer); \
- sfree(prep_area->values_buffer); \
- sfree(prep_area->metadata_buffer); \
+ udb_result_finish_result(r, prep_area); \
return (status)
- /* Make sure previous preparations are cleaned up. */
- udb_result_finish_result(r, prep_area);
- prep_area->instances_pos = NULL;
- prep_area->values_pos = NULL;
- prep_area->metadata_pos = NULL;
-
/* Read `ds' and check number of values {{{ */
prep_area->ds = plugin_get_ds(r->type);
if (prep_area->ds == NULL) {
if ((q == NULL) || (prep_area == NULL))
return -EINVAL;
- udb_query_finish_result(q, prep_area);
+#if COLLECT_DEBUG
+ assert(prep_area->column_num == 0);
+ assert(prep_area->host == NULL);
+ assert(prep_area->plugin == NULL);
+ assert(prep_area->db_name == NULL);
+ assert(prep_area->interval == 0);
+#endif
prep_area->column_num = column_num;
prep_area->host = strdup(host);