Refactoring: move count to an output parameter
[lttng-tools.git] / src / common / tracker.c
index 7742f47bcbdd88d9bb5bb67f51483ebff59a0cb1..afc253def71f990f77bb50923adde56bf481880e 100644 (file)
@@ -277,10 +277,19 @@ const struct lttng_tracker_id *lttng_tracker_ids_get_at_index(
        return lttng_tracker_ids_get_pointer_of_index(ids, index);
 }
 
-int lttng_tracker_ids_get_count(const struct lttng_tracker_ids *ids)
+int lttng_tracker_ids_get_count(const struct lttng_tracker_ids *ids, unsigned int *count)
 {
-       assert(ids);
-       return ids->count;
+
+       enum lttng_tracker_id_status status = LTTNG_ROTATION_STATUS_OK;
+
+       if (!ids || !count) {
+               status = LTTNG_ROTATION_STATUS_INVALID;
+               goto end;
+       }
+
+       *count = ids->count;
+end:
+       return status;
 }
 
 void lttng_tracker_ids_destroy(struct lttng_tracker_ids *ids)
This page took 0.023965 seconds and 5 git commands to generate.