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. 22
      vtest/vtest_server.c

@ -117,31 +117,27 @@ while (__AFL_LOOP(1000)) {
vtest_server_getenv(); vtest_server_getenv();
vtest_server_parse_args(argc, argv); vtest_server_parse_args(argc, argv);
if (server.read_file != NULL) {
vtest_server_open_read_file();
goto start;
}
if (server.do_fork) { if (server.do_fork) {
vtest_server_set_signal_child(); vtest_server_set_signal_child();
} else { } else {
vtest_server_set_signal_segv(); vtest_server_set_signal_segv();
} }
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_open_socket();
restart:
vtest_server_wait_for_socket_accept();
start: do {
vtest_server_wait_for_socket_accept();
vtest_server_run_renderer(&server.client); vtest_server_run_renderer(&server.client);
vtest_server_tidy_fds(); vtest_server_tidy_fds();
} while (server.loop);
if (server.loop) {
goto restart;
}
vtest_server_close_socket(); vtest_server_close_socket();
}
#ifdef __AFL_LOOP #ifdef __AFL_LOOP
if (!server.main_server) { if (!server.main_server) {

Loading…
Cancel
Save