Move locally scoped variables from "switch" statement into outer "for" loop, to avoid triggering a crash in the "splint" code analyser.

This commit is contained in:
Andrew Wood
2023-10-15 22:29:37 +01:00
parent b0df2e53a8
commit d8e0674da0
2 changed files with 47 additions and 43 deletions
+8 -8
View File
@@ -169,6 +169,14 @@ struct pvstate_s {
* Display state *
*****************/
struct {
/*@only@*/ /*@null@*/ char *display_buffer;
size_t display_buffer_size;
size_t lastoutput_length; /* number of last-output bytes to show */
char lastoutput_buffer[PV_SIZEOF_LASTOUTPUT_BUFFER];
int prev_width; /* screen width last time we were called */
int prev_length; /* length of last string we output */
bool display_visible; /* set once anything written to terminal */
long percentage;
long double prev_elapsed_sec;
long double prev_rate;
@@ -187,14 +195,6 @@ struct pvstate_s {
off_t initial_offset; /* offset when first opened (when watching fds) */
/*@null@*/ /*@only@*/ char *display_buffer;
long display_buffer_size;
size_t lastoutput_length; /* number of last-output bytes to show */
char lastoutput_buffer[PV_SIZEOF_LASTOUTPUT_BUFFER];
int prev_width; /* screen width last time we were called */
int prev_length; /* length of last string we output */
bool display_visible; /* set once anything written to terminal */
size_t format_segment_count; /* number of format string segments */
struct { /* format string broken into display components */
pv_display_component type; /* type of display component */