libsysprof-capture: Assert rather than calling g_warning()

Calling this function without having registered the counter beforehand
seems reasonable to call a programmer error.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Helps: #40
This commit is contained in:
Philip Withnall
2020-07-02 09:54:16 +01:00
parent e26eae5bcf
commit e4813cd729

View File

@ -1224,12 +1224,8 @@ sysprof_capture_writer_define_counters (SysprofCaptureWriter *self,
for (i = 0; i < n_counters; i++)
{
if (counters[i].id >= self->next_counter_id)
{
g_warning ("Counter %u has not been registered.", counters[i].id);
continue;
}
/* Has the counter been registered? */
assert (counters[i].id < self->next_counter_id);
def->counters[i] = counters[i];
}