From a46e54583d13b0bd79a6de27310ccbdbcc4cbc72 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 30 Jul 2019 14:27:51 +0200 Subject: [PATCH] scriptreplay: (utils) detect empty steps Signed-off-by: Karel Zak --- term-utils/script-playutils.c | 7 +++++++ term-utils/script-playutils.h | 1 + 2 files changed, 8 insertions(+) diff --git a/term-utils/script-playutils.c b/term-utils/script-playutils.c index 39662250d9..593af5dbe2 100644 --- a/term-utils/script-playutils.c +++ b/term-utils/script-playutils.c @@ -277,6 +277,13 @@ const char *replay_step_get_filename(struct replay_step *step) return step->data->filename; } +int replay_step_is_empty(struct replay_step *step) +{ + assert(step); + return step->size == 0 && step->type == 0; +} + + static int read_multistream_step(struct replay_step *step, FILE *f, char type) { int rc = 0; diff --git a/term-utils/script-playutils.h b/term-utils/script-playutils.h index 9e2e8aa247..18d96d9620 100644 --- a/term-utils/script-playutils.h +++ b/term-utils/script-playutils.h @@ -42,6 +42,7 @@ int replay_set_delay_div(struct replay_setup *stp, const double divi); struct timeval *replay_step_get_delay(struct replay_step *step); const char *replay_step_get_filename(struct replay_step *step); +int replay_step_is_empty(struct replay_step *step); int replay_get_next_step(struct replay_setup *stp, char *streams, struct replay_step **xstep); int replay_emit_step_data(struct replay_setup *stp, struct replay_step *step, int fd); -- 2.39.2