[glib: 1/2] gbacktrace: Fix a set-but-not-used variable
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/2] gbacktrace: Fix a set-but-not-used variable
- Date: Fri, 18 Feb 2022 10:39:23 +0000 (UTC)
commit 0694c1a5ade124d776e3d15b64206417f91ddf9b
Author: Philip Withnall <pwithnall endlessos org>
Date: Thu Feb 17 21:46:39 2022 +0000
gbacktrace: Fix a set-but-not-used variable
It’s only used if building for lldb. Spotted in the log from an oss-fuzz
build:
https://oss-fuzz-build-logs.storage.googleapis.com/log-051f05da-adf5-42c1-8f14-5e36ba750573.txt:
```
Step #12 - "compile-honggfuzz-address-x86_64": [36/1232] Compiling C object
glib/libglib-2.0.a.p/gbacktrace.c.o
Step #12 - "compile-honggfuzz-address-x86_64": ../../src/glib/glib/gbacktrace.c:324:24: warning: variable
'line_idx' set but not used [-Wunused-but-set-variable]
Step #12 - "compile-honggfuzz-address-x86_64": int sel, idx, state, line_idx;
Step #12 - "compile-honggfuzz-address-x86_64": ^
Step #12 - "compile-honggfuzz-address-x86_64": 1 warning generated.
```
Signed-off-by: Philip Withnall <pwithnall endlessos org>
glib/gbacktrace.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/glib/gbacktrace.c b/glib/gbacktrace.c
index eb9ec8d66..77cef100a 100644
--- a/glib/gbacktrace.c
+++ b/glib/gbacktrace.c
@@ -321,7 +321,10 @@ stack_trace (const char * const *args)
fd_set fdset;
fd_set readset;
struct timeval tv;
- int sel, idx, state, line_idx;
+ int sel, idx, state;
+#ifdef USE_LLDB
+ int line_idx;
+#endif
char buffer[BUFSIZE];
char c;
@@ -382,7 +385,9 @@ stack_trace (const char * const *args)
#endif
idx = 0;
+#ifdef USE_LLDB
line_idx = 0;
+#endif
state = 0;
while (1)
@@ -399,7 +404,10 @@ stack_trace (const char * const *args)
{
if (read (out_fd[0], &c, 1))
{
+#ifdef USE_LLDB
line_idx += 1;
+#endif
+
switch (state)
{
case 0:
@@ -423,7 +431,9 @@ stack_trace (const char * const *args)
_g_fprintf (stdout, "%s", buffer);
state = 0;
idx = 0;
+#ifdef USE_LLDB
line_idx = 0;
+#endif
}
break;
default:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]