From f6b21963693149bb4bd8e50c76ebbdba51d3472f Mon Sep 17 00:00:00 2001 From: Andrew Wood Date: Sun, 10 May 2026 20:05:42 +0100 Subject: [PATCH] Reduce the scope of offset (cppcheck recommendation). --- src/pv/state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pv/state.c b/src/pv/state.c index 6e957b8..1a349de 100644 --- a/src/pv/state.c +++ b/src/pv/state.c @@ -736,7 +736,6 @@ void pv_state_format_string_set(pvstate_t state, /*@null@ */ const char *val) void pv_state_extra_display_set(pvstate_t state, /*@null@ */ const char *val) { const char *word_start; - size_t offset; if (NULL != state->control.extra_display_spec) { free(state->control.extra_display_spec); @@ -757,6 +756,8 @@ void pv_state_extra_display_set(pvstate_t state, /*@null@ */ const char *val) word_start = val; while (NULL != word_start && '\0' != word_start[0]) { + size_t offset; + offset = 0; while ('\0' != word_start[offset] && ',' != word_start[offset] && ':' != word_start[offset]) offset++;