[sysprof] stackstash: add assertions before silencing warnings
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof] stackstash: add assertions before silencing warnings
- Date: Sat, 2 Apr 2022 00:04:32 +0000 (UTC)
commit 8ed6af618b25b56bc9e210e4345a336eb962a6d4
Author: Christian Hergert <chergert redhat com>
Date: Fri Apr 1 17:04:27 2022 -0700
stackstash: add assertions before silencing warnings
GCC warns about dangling pointers here, which is completely fine given
how this code works.
src/stackstash.c | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/src/stackstash.c b/src/stackstash.c
index 9b333598..f51737fe 100644
--- a/src/stackstash.c
+++ b/src/stackstash.c
@@ -273,7 +273,10 @@ do_callback (StackNode *node,
StackLink link;
if (trace)
+ {
+ g_assert (trace->prev == NULL);
trace->prev = &link;
+ }
link.next = trace;
link.prev = NULL;
@@ -291,7 +294,10 @@ do_callback (StackNode *node,
}
if (trace)
+ {
+ g_assert (trace->prev == &link);
trace->prev = NULL;
+ }
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]