src/main/win32/SDL_win32_main.c
changeset 1423 4ed717f9e509
parent 1379 c0a74f199ecf
child 1433 bb6839704ed6
     1.1 --- a/src/main/win32/SDL_win32_main.c	Fri Feb 24 07:26:31 2006 +0000
     1.2 +++ b/src/main/win32/SDL_win32_main.c	Fri Feb 24 08:17:28 2006 +0000
     1.3 @@ -188,6 +188,7 @@
     1.4  {
     1.5  	int n;
     1.6  	char *bufp, *appname;
     1.7 +	int status;
     1.8  
     1.9  	/* Get the class name from argv[0] */
    1.10  	appname = argv[0];
    1.11 @@ -203,7 +204,7 @@
    1.12  	else
    1.13  		n = (bufp-appname);
    1.14  
    1.15 -	bufp = (char *)alloca(n+1);
    1.16 +	bufp = SDL_stack_alloc(char, n+1);
    1.17  	if ( bufp == NULL ) {
    1.18  		return OutOfMemory();
    1.19  	}
    1.20 @@ -226,13 +227,13 @@
    1.21  	SDL_SetModuleHandle(GetModuleHandle(NULL));
    1.22  
    1.23  	/* Run the application main() code */
    1.24 -	SDL_main(argc, argv);
    1.25 +	status = SDL_main(argc, argv);
    1.26  
    1.27  	/* Exit cleanly, calling atexit() functions */
    1.28 -	exit(0);
    1.29 +	exit(status);
    1.30  
    1.31  	/* Hush little compiler, don't you cry... */
    1.32 -	return(0);
    1.33 +	return 0;
    1.34  }
    1.35  
    1.36  /* This is where execution begins [windowed apps] */
    1.37 @@ -262,7 +263,6 @@
    1.38  #ifndef NO_STDIO_REDIRECT
    1.39  	FILE *newfp;
    1.40  #endif
    1.41 -	int retval;
    1.42  
    1.43  	/* Start up DDHELP.EXE before opening any files, so DDHELP doesn't
    1.44  	   keep them open.  This is a hack.. hopefully it will be fixed 
    1.45 @@ -322,7 +322,7 @@
    1.46  
    1.47  #ifdef _WIN32_WCE
    1.48  	nLen = wcslen(szCmdLine)+128+1;
    1.49 -	bufp = (wchar_t *)alloca(nLen*2);
    1.50 +	bufp = SDL_stack_alloc(wchar_t, nLen*2);
    1.51  	wcscpy (bufp, TEXT("\""));
    1.52  	GetModuleFileName(NULL, bufp+1, 128-3);
    1.53  	wcscpy (bufp+wcslen(bufp), TEXT("\" "));
    1.54 @@ -334,7 +334,7 @@
    1.55  	}
    1.56  	WideCharToMultiByte(CP_ACP, 0, bufp, -1, cmdline, nLen, NULL, NULL);
    1.57  #else
    1.58 -	/* Grab the command line (use alloca() on Windows) */
    1.59 +	/* Grab the command line */
    1.60  	bufp = GetCommandLine();
    1.61  	nLen = SDL_strlen(bufp)+1;
    1.62  	cmdline = SDL_stack_alloc(char, nLen);
    1.63 @@ -353,9 +353,8 @@
    1.64  	ParseCommandLine(cmdline, argv);
    1.65  
    1.66  	/* Run the main program (after a little SDL initialization) */
    1.67 -	retval = console_main(argc, argv);
    1.68 +	console_main(argc, argv);
    1.69  
    1.70 -	SDL_stack_free(cmdline);
    1.71 -	SDL_stack_free(argv);
    1.72 -	return retval;
    1.73 +	/* Hush little compiler, don't you cry... */
    1.74 +	return 0;
    1.75  }