From: Francois-Xavier Le Bail Date: Thu, 4 May 2023 11:24:06 +0000 (+0200) Subject: instrument functions: Reduce the scope of a variable X-Git-Tag: tcpslice-1.7~23 X-Git-Url: https://git.tcpdump.org/tcpslice/commitdiff_plain/16a41029ad86b56c6def4d8cfea0f768bf0533a5 instrument functions: Reduce the scope of a variable Fix the cppcheck warning: instrument-functions.c:77:15: warning: The scope of the variable 'instrument_type' can be reduced. [variableScope] [skip ci] --- diff --git a/instrument-functions.c b/instrument-functions.c index 350a168..2c1ad33 100644 --- a/instrument-functions.c +++ b/instrument-functions.c @@ -74,13 +74,14 @@ static void print_debug(void *this_fn, void *call_site, action_type action) static long symcount; static asection *text; static bfd_vma vma; - static char *instrument_type; static int instrument_set; static int instrument_off; static int instrument_global; int i; if (!instrument_set) { + static char *instrument_type; + /* Get the configuration environment variable INSTRUMENT value if any */ instrument_type = getenv("INSTRUMENT"); /* unset or set to an empty string ? */