test: simplify platform_init()
PR-URL: https://github.com/libuv/libuv/pull/2755 Reviewed-By: Richard Lau <riclau@uk.ibm.com>
This commit is contained in:
parent
fa1da18549
commit
0ed9692a80
@ -33,8 +33,7 @@ static int maybe_run_test(int argc, char **argv);
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (platform_init(argc, argv))
|
||||
return EXIT_FAILURE;
|
||||
platform_init(argc, argv);
|
||||
|
||||
switch (argc) {
|
||||
case 1: return run_tests(1);
|
||||
|
||||
@ -59,9 +59,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
#endif
|
||||
|
||||
if (platform_init(argc, argv))
|
||||
return EXIT_FAILURE;
|
||||
|
||||
platform_init(argc, argv);
|
||||
argv = uv_setup_args(argc, argv);
|
||||
|
||||
switch (argc) {
|
||||
|
||||
@ -67,13 +67,12 @@ void notify_parent_process(void) {
|
||||
|
||||
|
||||
/* Do platform-specific initialization. */
|
||||
int platform_init(int argc, char **argv) {
|
||||
void platform_init(int argc, char **argv) {
|
||||
/* Disable stdio output buffering. */
|
||||
setvbuf(stdout, NULL, _IONBF, 0);
|
||||
setvbuf(stderr, NULL, _IONBF, 0);
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
snprintf(executable_path, sizeof(executable_path), "%s", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
|
||||
|
||||
/* Do platform-specific initialization. */
|
||||
int platform_init(int argc, char **argv) {
|
||||
void platform_init(int argc, char **argv) {
|
||||
/* Disable the "application crashed" popup. */
|
||||
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX |
|
||||
SEM_NOOPENFILEERRORBOX);
|
||||
@ -67,8 +67,6 @@ int platform_init(int argc, char **argv) {
|
||||
setvbuf(stderr, NULL, _IONBF, 0);
|
||||
|
||||
strcpy(executable_path, argv[0]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -132,7 +132,7 @@ void print_lines(const char* buffer, size_t size, FILE* stream);
|
||||
*/
|
||||
|
||||
/* Do platform-specific initialization. */
|
||||
int platform_init(int argc, char** argv);
|
||||
void platform_init(int argc, char** argv);
|
||||
|
||||
/* Invoke "argv[0] test-name [test-part]". Store process info in *p. Make sure
|
||||
* that all stdio output of the processes is buffered up. */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user