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>
This commit is contained in:
Philip Withnall 2022-02-17 21:46:39 +00:00
parent d286ea0c57
commit 0694c1a5ad

View File

@ -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: