From 762676f4e11e3015a2bccda0d7622631e8359f40 Mon Sep 17 00:00:00 2001 From: Andrew Wood Date: Sat, 26 Jul 2025 21:18:13 +0100 Subject: [PATCH] Make pv_tty_write take only the transient flags part of the state rather than the whole state, and rename the "flag" part of the state to "flags" for better readability (#165). --- src/include/pv-internal.h | 4 +-- src/pv/cursor.c | 20 +++++++-------- src/pv/display.c | 22 ++++++++-------- src/pv/loop.c | 54 +++++++++++++++++++-------------------- src/pv/signal.c | 48 +++++++++++++++++----------------- src/pv/state.c | 4 +-- src/pv/transfer.c | 2 +- src/pv/watchpid.c | 6 ++--- 8 files changed, 80 insertions(+), 80 deletions(-) diff --git a/src/include/pv-internal.h b/src/include/pv-internal.h index 5e72594..087b810 100644 --- a/src/include/pv-internal.h +++ b/src/include/pv-internal.h @@ -241,7 +241,7 @@ struct pvstate_s { volatile sig_atomic_t suspend_stderr; /* whether writing to stderr is suspended */ volatile sig_atomic_t skip_next_sigcont; /* whether to ignore the next SIGCONT */ volatile sig_atomic_t pipe_closed; /* whether the output pipe was closed */ - } flag; + } flags; /***************** * Display state * @@ -565,7 +565,7 @@ int pv_next_file(pvstate_t, unsigned int, int); /*@keep@*/ const char *pv_current_file_name(pvstate_t); void pv_write_retry(int, const char *, size_t); -void pv_tty_write(pvstate_t, const char *, size_t); +void pv_tty_write(readonly_pvtransientflags_t, const char *, size_t); void pv_crs_fini(pvstate_t); void pv_crs_init(pvstate_t); diff --git a/src/pv/cursor.c b/src/pv/cursor.c index 1e7b443..baf28b5 100644 --- a/src/pv/cursor.c +++ b/src/pv/cursor.c @@ -411,7 +411,7 @@ void pv_crs_init(pvstate_t state) * If we have already set the terminal TOSTOP attribute, set the * flag in shared memory to let the other instances know. */ - if ((!state->cursor.noipc) && (1 == state->flag.clear_tty_tostop_on_exit) && (NULL != state->cursor.shared)) { + if ((!state->cursor.noipc) && (1 == state->flags.clear_tty_tostop_on_exit) && (NULL != state->cursor.shared)) { debug("%s", "propagating local clear_tty_tostop_on_exit true value to shared tty_tostop_added flag"); state->cursor.shared->tty_tostop_added = true; } @@ -436,7 +436,7 @@ void pv_crs_init(pvstate_t state) * initial ypos. */ if (state->cursor.y_start > 0) - pv_tty_write(state, "\n", 1); + pv_tty_write(&(state->flags), "\n", 1); pv_crs_unlock(state, terminalfd); if (state->cursor.y_start < 1) @@ -469,7 +469,7 @@ static void pv_crs_reinit(pvstate_t state) { debug("%s", "reinit"); - if (1 == state->flag.suspend_stderr) { + if (1 == state->flags.suspend_stderr) { debug("%s", "reinit abandoned - stderr is suspended"); return; } @@ -568,9 +568,9 @@ void pv_crs_update(pvstate_t state, const char *output_line) memset(cup_cmd, 0, sizeof(cup_cmd)); (void) pv_snprintf(cup_cmd, sizeof(cup_cmd), "\033[%u;1H", state->control.height); cup_cmd_length = strlen(cup_cmd); /* flawfinder: ignore */ - pv_tty_write(state, cup_cmd, cup_cmd_length); + pv_tty_write(&(state->flags), cup_cmd, cup_cmd_length); for (; offs > 0; offs--) { - pv_tty_write(state, "\n", 1); + pv_tty_write(&(state->flags), "\n", 1); } pv_crs_unlock(state, STDERR_FILENO); @@ -603,8 +603,8 @@ void pv_crs_update(pvstate_t state, const char *output_line) pv_crs_lock(state, STDERR_FILENO); - pv_tty_write(state, cup_cmd, cup_cmd_length); - pv_tty_write(state, output_line, output_line_length); + pv_tty_write(&(state->flags), cup_cmd, cup_cmd_length); + pv_tty_write(&(state->flags), output_line, output_line_length); pv_crs_unlock(state, STDERR_FILENO); } @@ -643,7 +643,7 @@ void pv_crs_fini(pvstate_t state) pv_crs_lock(state, STDERR_FILENO); - pv_tty_write(state, cup_cmd, strlen(cup_cmd)); /* flawfinder: ignore */ + pv_tty_write(&(state->flags), cup_cmd, strlen(cup_cmd)); /* flawfinder: ignore */ /* flawfinder - pv_snprintf() always \0-terminates (see above). */ #ifdef HAVE_IPC @@ -653,10 +653,10 @@ void pv_crs_fini(pvstate_t state) * it. */ if ((!state->cursor.noipc) && (NULL != state->cursor.shared) && state->cursor.shared->tty_tostop_added) { - if (0 == state->flag.clear_tty_tostop_on_exit) { + if (0 == state->flags.clear_tty_tostop_on_exit) { debug("%s", "propagating shared tty_tostop_added true value to local clear_tty_tostop_on_exit flag"); - state->flag.clear_tty_tostop_on_exit = 1; + state->flags.clear_tty_tostop_on_exit = 1; } } diff --git a/src/pv/display.c b/src/pv/display.c index 782fb12..52c0e26 100644 --- a/src/pv/display.c +++ b/src/pv/display.c @@ -140,9 +140,9 @@ void pv_write_retry(int fd, const char *buf, size_t count) * Write the given buffer to the terminal, like pv_write_retry(), unless * stderr is suspended. */ -void pv_tty_write(pvstate_t state, const char *buf, size_t count) +void pv_tty_write(readonly_pvtransientflags_t flags, const char * buf, size_t count) { - while (0 == state->flag.suspend_stderr && count > 0) { + while (0 == flags->suspend_stderr && count > 0) { ssize_t nwritten; nwritten = write(STDERR_FILENO, buf, count); @@ -1207,9 +1207,9 @@ void pv_display(pvstate_t state, bool final) * If the display options need reparsing, do so to generate new * formatting parameters. */ - if (0 != state->flag.reparse_display) { + if (0 != state->flags.reparse_display) { reinitialise = true; - state->flag.reparse_display = 0; + state->flags.reparse_display = 0; } if (!pv_format(state, state->control.format_string, &(state->display), reinitialise, final)) @@ -1224,8 +1224,8 @@ void pv_display(pvstate_t state, bool final) return; if (state->control.numeric) { - pv_tty_write(state, state->display.display_buffer, state->display.display_string_bytes); - pv_tty_write(state, "\n", 1); + pv_tty_write(&(state->flags), state->display.display_buffer, state->display.display_string_bytes); + pv_tty_write(&(state->flags), "\n", 1); } else if (state->control.cursor) { if (state->control.force || pv_in_foreground()) { pv_crs_update(state, state->display.display_buffer); @@ -1233,8 +1233,8 @@ void pv_display(pvstate_t state, bool final) } } else { if (state->control.force || pv_in_foreground()) { - pv_tty_write(state, state->display.display_buffer, state->display.display_string_bytes); - pv_tty_write(state, "\r", 1); + pv_tty_write(&(state->flags), state->display.display_buffer, state->display.display_string_bytes); + pv_tty_write(&(state->flags), "\r", 1); state->display.display_visible = true; } } @@ -1245,9 +1245,9 @@ void pv_display(pvstate_t state, bool final) && (state->control.force || pv_in_foreground()) && (NULL != state->extra_display.display_buffer) ) { - pv_tty_write(state, "\033]2;", 4); - pv_tty_write(state, state->extra_display.display_buffer, state->extra_display.display_string_bytes); - pv_tty_write(state, "\033\\", 2); + pv_tty_write(&(state->flags), "\033]2;", 4); + pv_tty_write(&(state->flags), state->extra_display.display_buffer, state->extra_display.display_string_bytes); + pv_tty_write(&(state->flags), "\033\\", 2); state->extra_display.display_visible = true; debug("%s: [%s]", "windowtitle display", state->extra_display.display_buffer); } diff --git a/src/pv/loop.c b/src/pv/loop.c index 8c9887f..1524d58 100644 --- a/src/pv/loop.c +++ b/src/pv/loop.c @@ -223,7 +223,7 @@ int pv_main_loop(pvstate_t state) pv_elapsedtime_add_nsec(&next_remotecheck, REMOTE_INTERVAL); } - if (1 == state->flag.trigger_exit) + if (1 == state->flags.trigger_exit) break; if (state->control.rate_limit > 0) { @@ -292,7 +292,7 @@ int pv_main_loop(pvstate_t state) if (output_is_pipe) { int nbytes; nbytes = 0; - if (0 != state->flag.pipe_closed) { + if (0 != state->flags.pipe_closed) { if (0 != state->transfer.written_but_not_consumed) debug("%s", "clearing written_but_not_consumed because the output pipe was closed"); @@ -487,10 +487,10 @@ int pv_main_loop(pvstate_t state) state->transfer.elapsed_seconds = pv_elapsedtime_seconds(&transfer_elapsed); /* Resize the display, if a resize signal was received. */ - if (1 == state->flag.terminal_resized) { + if (1 == state->flags.terminal_resized) { unsigned int new_width, new_height; - state->flag.terminal_resized = 0; + state->flags.terminal_resized = 0; new_width = (unsigned int) (state->control.width); new_height = state->control.height; @@ -522,10 +522,10 @@ int pv_main_loop(pvstate_t state) } else { if ((!state->control.numeric) && (!state->control.no_display) && (state->display.display_visible)) - pv_tty_write(state, "\n", 1); + pv_tty_write(&(state->flags), "\n", 1); } - if (1 == state->flag.trigger_exit) + if (1 == state->flags.trigger_exit) state->status.exit_status |= PV_ERROREXIT_SIGNAL; if (input_fd >= 0) @@ -563,7 +563,7 @@ int pv_main_loop(pvstate_t state) rate_deviation, state->control.bits ? _("b/s") : _("B/s")); if (stats_size > 0 && stats_size < (int) (sizeof(stats_buf))) - pv_tty_write(state, stats_buf, (size_t) stats_size); + pv_tty_write(&(state->flags), stats_buf, (size_t) stats_size); } else if (state->control.show_stats && state->calc.measurements_taken < 1) { char msg_buf[256]; /* flawfinder: ignore */ int msg_size; @@ -574,7 +574,7 @@ int pv_main_loop(pvstate_t state) msg_size = pv_snprintf(msg_buf, sizeof(msg_buf), "%s\n", _("rate not measured")); if (msg_size > 0 && msg_size < (int) (sizeof(msg_buf))) - pv_tty_write(state, msg_buf, (size_t) msg_size); + pv_tty_write(&(state->flags), msg_buf, (size_t) msg_size); } return state->status.exit_status; @@ -623,7 +623,7 @@ int pv_watchfd_loop(pvstate_t state) /* strlen-1 here to include trailing \0 */ memmove(fmt, fmt + 2, strlen(fmt) - 1); /* flawfinder: ignore */ /* flawfinder: default_format is always \0 terminated */ - state->flag.reparse_display = 1; + state->flags.reparse_display = 1; } } @@ -651,7 +651,7 @@ int pv_watchfd_loop(pvstate_t state) pv_elapsedtime_add_nsec(&next_remotecheck, REMOTE_INTERVAL); } - if (1 == state->flag.trigger_exit) + if (1 == state->flags.trigger_exit) break; position_now = pv_watchfd_position(&info); @@ -704,10 +704,10 @@ int pv_watchfd_loop(pvstate_t state) state->transfer.elapsed_seconds = pv_elapsedtime_seconds(&transfer_elapsed); /* Resize the display, if a resize signal was received. */ - if (1 == state->flag.terminal_resized) { + if (1 == state->flags.terminal_resized) { unsigned int new_width, new_height; - state->flag.terminal_resized = 0; + state->flags.terminal_resized = 0; new_width = (unsigned int) (state->control.width); new_height = state->control.height; @@ -726,9 +726,9 @@ int pv_watchfd_loop(pvstate_t state) } if (!state->control.numeric) - pv_tty_write(state, "\n", 1); + pv_tty_write(&(state->flags), "\n", 1); - if (1 == state->flag.trigger_exit) + if (1 == state->flags.trigger_exit) state->status.exit_status |= PV_ERROREXIT_SIGNAL; /* @@ -825,7 +825,7 @@ int pv_watchpid_loop(pvstate_t state) while (true) { int rc, fd, displayed_lines; - if (1 == state->flag.trigger_exit) + if (1 == state->flags.trigger_exit) break; pv_elapsedtime_read(&cur_time); @@ -857,10 +857,10 @@ int pv_watchpid_loop(pvstate_t state) pv_elapsedtime_copy(&next_update, &cur_time); /* Resize the display, if a resize signal was received. */ - if (1 == state->flag.terminal_resized) { + if (1 == state->flags.terminal_resized) { unsigned int new_width, new_height; - state->flag.terminal_resized = 0; + state->flags.terminal_resized = 0; new_width = (unsigned int) (state->control.width); new_height = state->control.height; @@ -878,7 +878,7 @@ int pv_watchpid_loop(pvstate_t state) info_array[idx].state->control.width = state->control.width; info_array[idx].state->control.height = state->control.height; pv_watchpid_setname(state, &(info_array[idx])); - info_array[idx].state->flag.reparse_display = 1; + info_array[idx].state->flags.reparse_display = 1; } } @@ -974,7 +974,7 @@ int pv_watchpid_loop(pvstate_t state) if (displayed_lines > 0) { debug("%s", "adding newline"); - pv_tty_write(state, "\n", 1); + pv_tty_write(&(state->flags), "\n", 1); } if (NULL == info_array[idx].state) { @@ -1005,10 +1005,10 @@ int pv_watchpid_loop(pvstate_t state) while (blank_lines > 0) { pvdisplay_width_t blank_count; if (displayed_lines > 0) - pv_tty_write(state, "\n", 1); + pv_tty_write(&(state->flags), "\n", 1); for (blank_count = 0; blank_count < state->control.width; blank_count++) - pv_tty_write(state, " ", 1); - pv_tty_write(state, "\r", 1); + pv_tty_write(&(state->flags), " ", 1); + pv_tty_write(&(state->flags), "\r", 1); blank_lines--; displayed_lines++; } @@ -1016,7 +1016,7 @@ int pv_watchpid_loop(pvstate_t state) debug("%s: %d", "displayed lines", displayed_lines); while (displayed_lines > 1) { - pv_tty_write(state, "\033[A", 3); + pv_tty_write(&(state->flags), "\033[A", 3); displayed_lines--; } } @@ -1028,14 +1028,14 @@ int pv_watchpid_loop(pvstate_t state) while (blank_lines > 0) { pvdisplay_width_t blank_count; for (blank_count = 0; blank_count < state->control.width; blank_count++) - pv_tty_write(state, " ", 1); - pv_tty_write(state, "\r", 1); + pv_tty_write(&(state->flags), " ", 1); + pv_tty_write(&(state->flags), "\r", 1); blank_lines--; if (blank_lines > 0) - pv_tty_write(state, "\n", 1); + pv_tty_write(&(state->flags), "\n", 1); } while (prev_displayed_lines > 1) { - pv_tty_write(state, "\033[A", 3); + pv_tty_write(&(state->flags), "\033[A", 3); prev_displayed_lines--; } diff --git a/src/pv/signal.c b/src/pv/signal.c index 49c5640..36a84f9 100644 --- a/src/pv/signal.c +++ b/src/pv/signal.c @@ -43,7 +43,7 @@ static void pv_sig_ensure_tty_tostop() return; /* Can't look at terminal flags if backgrounded. */ - if (1 == pv_sig_state->flag.suspend_stderr) + if (1 == pv_sig_state->flags.suspend_stderr) return; if (0 != tcgetattr(STDERR_FILENO, &terminal_attributes)) { @@ -52,13 +52,13 @@ static void pv_sig_ensure_tty_tostop() } /* Can't set terminal flags if backgrounded. */ - if (1 == pv_sig_state->flag.suspend_stderr) + if (1 == pv_sig_state->flags.suspend_stderr) return; if (0 == (terminal_attributes.c_lflag & TOSTOP)) { terminal_attributes.c_lflag |= TOSTOP; if (0 == tcsetattr(STDERR_FILENO, TCSANOW, &terminal_attributes)) { - pv_sig_state->flag.clear_tty_tostop_on_exit = 1; + pv_sig_state->flags.clear_tty_tostop_on_exit = 1; debug("%s", "set terminal TOSTOP attribute"); #if HAVE_IPC /* @@ -95,11 +95,11 @@ static void pv_sig_ttou( /*@unused@ */ __attribute__((unused)) if (NULL == pv_sig_state) return; - if (1 != pv_sig_state->flag.suspend_stderr) { + if (1 != pv_sig_state->flags.suspend_stderr) { debug("%s", "SIGTTOU - suspending stderr"); - pv_sig_state->flag.suspend_stderr = 1; + pv_sig_state->flags.suspend_stderr = 1; /* Also tell the SIGCONT handler to do nothing next time. */ - pv_sig_state->flag.skip_next_sigcont++; + pv_sig_state->flags.skip_next_sigcont++; /* Raise an immediate SIGCONT to bring the rest of the pipeline back up. */ /*@-unrecog@ *//* splint doesn't know about killpg() */ if (0 != killpg(getpgrp(), SIGCONT)) { @@ -142,19 +142,19 @@ static void pv_sig_cont( /*@unused@ */ __attribute__((unused)) if (NULL == pv_sig_state) return; - if (pv_sig_state->flag.skip_next_sigcont > 0) { + if (pv_sig_state->flags.skip_next_sigcont > 0) { debug("%s: %d", "SIGCONT received but ignored - current value of skip_next_sigcont", - pv_sig_state->flag.skip_next_sigcont); - pv_sig_state->flag.skip_next_sigcont--; + pv_sig_state->flags.skip_next_sigcont); + pv_sig_state->flags.skip_next_sigcont--; return; - } else if (pv_sig_state->flag.skip_next_sigcont < 0) { - pv_sig_state->flag.skip_next_sigcont = 0; + } else if (pv_sig_state->flags.skip_next_sigcont < 0) { + pv_sig_state->flags.skip_next_sigcont = 0; debug("%s", "skip_next_sigcont underrun cleared"); } - debug("%s: %d", "SIGCONT received - current value of suspend_stderr", pv_sig_state->flag.suspend_stderr); + debug("%s: %d", "SIGCONT received - current value of suspend_stderr", pv_sig_state->flags.suspend_stderr); - pv_sig_state->flag.terminal_resized = 1; + pv_sig_state->flags.terminal_resized = 1; /* * We can only make the time adjustments if this SIGCONT followed a @@ -182,16 +182,16 @@ static void pv_sig_cont( /*@unused@ */ __attribute__((unused)) * Try resuming our use of stderr, if we had suspended it, but only * if we're now in the foreground. */ - if (1 == pv_sig_state->flag.suspend_stderr) { + if (1 == pv_sig_state->flags.suspend_stderr) { if (pv_in_foreground()) { debug("%s", "SIGCONT - resuming stderr"); - pv_sig_state->flag.suspend_stderr = 0; + pv_sig_state->flags.suspend_stderr = 0; } else { debug("%s", "SIGCONT but still in background - not resuming stderr"); } } - if (0 == pv_sig_state->flag.suspend_stderr) { + if (0 == pv_sig_state->flags.suspend_stderr) { pv_sig_ensure_tty_tostop(); #ifdef HAVE_IPC pv_crs_needreinit(pv_sig_state); @@ -209,7 +209,7 @@ static void pv_sig_winch( /*@unused@ */ __attribute__((unused)) { if (NULL == pv_sig_state) return; - pv_sig_state->flag.terminal_resized = 1; + pv_sig_state->flags.terminal_resized = 1; } #endif @@ -222,7 +222,7 @@ static void pv_sig_term( /*@unused@ */ __attribute__((unused)) { if (NULL == pv_sig_state) return; - pv_sig_state->flag.trigger_exit = 1; + pv_sig_state->flags.trigger_exit = 1; } @@ -297,7 +297,7 @@ void pv_sig_init(pvstate_t state) pv_sig_state = state; - pv_sig_state->flag.suspend_stderr = 0; + pv_sig_state->flags.suspend_stderr = 0; pv_elapsedtime_zero(&(pv_sig_state->signal.tstp_time)); pv_elapsedtime_zero(&(pv_sig_state->signal.toffset)); @@ -320,7 +320,7 @@ void pv_sig_init(pvstate_t state) * Handle SIGTTOU by continuing with output switched off, so that we * can be stopped and backgrounded without messing up the terminal. */ - pv_sig_state->flag.skip_next_sigcont = 0; + pv_sig_state->flags.skip_next_sigcont = 0; sa.sa_handler = pv_sig_ttou; (void) sigemptyset(&(sa.sa_mask)); sa.sa_flags = 0; @@ -436,7 +436,7 @@ void pv_sig_fini( /*@unused@ */ __attribute__((unused)) pvstate_t state) #endif (void) sigaction(SIGALRM, &(pv_sig_state->signal.old_sigalrm), NULL); - need_to_clear_tostop = (1 == pv_sig_state->flag.clear_tty_tostop_on_exit) ? true : false; + need_to_clear_tostop = (1 == pv_sig_state->flags.clear_tty_tostop_on_exit) ? true : false; if (pv_sig_state->control.cursor) { #ifdef HAVE_IPC @@ -477,7 +477,7 @@ void pv_sig_fini( /*@unused@ */ __attribute__((unused)) pvstate_t state) } } - pv_sig_state->flag.clear_tty_tostop_on_exit = 0; + pv_sig_state->flags.clear_tty_tostop_on_exit = 0; } } @@ -537,14 +537,14 @@ void pv_sig_checkbg(void) next_check = time(NULL) + 1; - if (0 == pv_sig_state->flag.suspend_stderr) + if (0 == pv_sig_state->flags.suspend_stderr) return; if (!pv_in_foreground()) return; debug("%s: %s", "pv_sig_checkbg", "attempting to resume stderr"); - pv_sig_state->flag.suspend_stderr = 0; + pv_sig_state->flags.suspend_stderr = 0; pv_sig_ensure_tty_tostop(); #ifdef HAVE_IPC diff --git a/src/pv/state.c b/src/pv/state.c index 1d3936c..e5b454a 100644 --- a/src/pv/state.c +++ b/src/pv/state.c @@ -55,7 +55,7 @@ void pv_state_reset(pvstate_t state) if (NULL == state) return; - state->flag.reparse_display = 1; + state->flags.reparse_display = 1; state->status.current_input_file = -1; state->display.initial_offset = 0; @@ -316,7 +316,7 @@ void pv_state_set_format(pvstate_t state, bool progress, bool timer, bool eta, b state->control.name = pv_strdup(name); /* Tell pv_format() that the format has changed. */ - state->flag.reparse_display = 1; + state->flags.reparse_display = 1; } diff --git a/src/pv/transfer.c b/src/pv/transfer.c index 79b79d3..24de0af 100644 --- a/src/pv/transfer.c +++ b/src/pv/transfer.c @@ -910,7 +910,7 @@ static int pv__transfer_write(pvstate_t state, bool *eof_in, bool *eof_out, long if (EPIPE == write_errno) { *eof_in = true; *eof_out = true; - state->flag.pipe_closed = 1; + state->flags.pipe_closed = 1; debug("%s", "SIGPIPE received - setting pipe_closed"); return 0; } diff --git a/src/pv/watchpid.c b/src/pv/watchpid.c index e6461a7..cf9990a 100644 --- a/src/pv/watchpid.c +++ b/src/pv/watchpid.c @@ -575,13 +575,13 @@ int pv_watchpid_scanfds(pvstate_t state, debug("%s", "zero size - removing estimated time remaining"); /* strlen-1 here to include trailing \0 */ memmove(fmt, fmt + 2, strlen(fmt) - 1); /* flawfinder: ignore */ - info_array[use_idx].state->flag.reparse_display = 1; + info_array[use_idx].state->flags.reparse_display = 1; } while (NULL != (fmt = strstr(info_array[use_idx].state->control.default_format, "%I"))) { debug("%s", "zero size - removing estimated completion time"); /* strlen-1 here to include trailing \0 */ memmove(fmt, fmt + 2, strlen(fmt) - 1); /* flawfinder: ignore */ - info_array[use_idx].state->flag.reparse_display = 1; + info_array[use_idx].state->flags.reparse_display = 1; } /* flawfinder: default_format is always \0-terminated. */ } @@ -591,7 +591,7 @@ int pv_watchpid_scanfds(pvstate_t state, /* Carry the display_name through to the display state, and reparse. */ pv_state_name_set(info_array[use_idx].state, info_array[use_idx].display_name); - info_array[use_idx].state->flag.reparse_display = 1; + info_array[use_idx].state->flags.reparse_display = 1; pv_elapsedtime_read(&(info_array[use_idx].start_time));