From: Lelik P. Korchagin Date: Tue, 31 Oct 2023 16:38:56 +0000 (+0300) Subject: opt_s optimization X-Git-Url: https://git.keenfalcon.ru/?a=commitdiff_plain;p=fpvtools.git opt_s optimization --- diff --git a/fpvplay.c b/fpvplay.c index 1a1e397..cffc913 100644 --- a/fpvplay.c +++ b/fpvplay.c @@ -139,7 +139,6 @@ int main(int argc, char *argv[]) for (int i = 0; (optind + i) < argc; i++) { int file = open(argv[optind + i], O_RDONLY); - int play = 0; int ms = 0; if (file < 0) { @@ -148,12 +147,14 @@ int main(int argc, char *argv[]) while (1) { static struct flight_data_record r; // flight_data_record is too large to be allocated ot the top of the stack !!! + int sleep; if (get_record(file, &r) < 0) { break; } if (opt_s > 0 && r.ms < opt_s) { + ms = r.ms; continue; } @@ -161,11 +162,8 @@ int main(int argc, char *argv[]) break; } - if (play) { - int sleep = r.ms - ms; - if (sleep > 0) { - usleep(sleep * 1000); - } + if ((sleep = r.ms - ms) > 0) { + usleep(sleep * 1000); } ms = r.ms;