vtest: replace gotos by a loop in main

Get rid of gotos so that it will be easier when we turn
vtest_server_run_renderer into the main loop.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Reviewed-By: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Chia-I Wu 5 years ago
parent 134dcfb658
commit 861ba2a6cb
  1. 28
      vtest/vtest_server.c

@ -117,32 +117,28 @@ while (__AFL_LOOP(1000)) {
vtest_server_getenv();
vtest_server_parse_args(argc, argv);
if (server.read_file != NULL) {
vtest_server_open_read_file();
goto start;
}
if (server.do_fork) {
vtest_server_set_signal_child();
} else {
vtest_server_set_signal_segv();
}
vtest_server_open_socket();
restart:
vtest_server_wait_for_socket_accept();
start:
vtest_server_run_renderer(&server.client);
if (server.read_file != NULL) {
vtest_server_open_read_file();
vtest_server_run_renderer(&server.client);
vtest_server_tidy_fds();
} else {
vtest_server_open_socket();
vtest_server_tidy_fds();
do {
vtest_server_wait_for_socket_accept();
vtest_server_run_renderer(&server.client);
vtest_server_tidy_fds();
} while (server.loop);
if (server.loop) {
goto restart;
vtest_server_close_socket();
}
vtest_server_close_socket();
#ifdef __AFL_LOOP
if (!server.main_server) {
exit(0);

Loading…
Cancel
Save