[sysprof: 24/63] libsysprof-capture: Assert rather than calling g_warning()
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof: 24/63] libsysprof-capture: Assert rather than calling g_warning()
- Date: Sat, 4 Jul 2020 18:31:21 +0000 (UTC)
commit e4813cd7292807961259de6c2321f5fbd7950ef9
Author: Philip Withnall <withnall endlessm com>
Date: Thu Jul 2 09:54:16 2020 +0100
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
src/libsysprof-capture/sysprof-capture-writer.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
---
diff --git a/src/libsysprof-capture/sysprof-capture-writer.c b/src/libsysprof-capture/sysprof-capture-writer.c
index cb8c90a..8cd8898 100644
--- a/src/libsysprof-capture/sysprof-capture-writer.c
+++ b/src/libsysprof-capture/sysprof-capture-writer.c
@@ -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];
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]