Patched to compile on C89 compilers.

main
Ryan C. Gordon 2015-03-24 14:40:31 -04:00
parent 672ccb4f54
commit 3f9f0027bc
1 changed files with 21 additions and 12 deletions

View File

@ -46,15 +46,9 @@ SDL_HandleSIG(int sig)
#endif /* HAVE_SIGNAL_H */ #endif /* HAVE_SIGNAL_H */
/* Public functions */ /* Public functions */
int static int
SDL_QuitInit(void) SDL_QuitInit_Internal(void)
{ {
const char *hint = SDL_GetHint(SDL_HINT_NO_SIGNAL_HANDLERS);
disable_signals = hint && (SDL_atoi(hint) == 1);
if (disable_signals) {
return 0;
}
#ifdef HAVE_SIGACTION #ifdef HAVE_SIGACTION
struct sigaction action; struct sigaction action;
sigaction(SIGINT, NULL, &action); sigaction(SIGINT, NULL, &action);
@ -92,13 +86,20 @@ SDL_QuitInit(void)
return 0; return 0;
} }
void int
SDL_QuitQuit(void) SDL_QuitInit(void)
{ {
if (disable_signals) { const char *hint = SDL_GetHint(SDL_HINT_NO_SIGNAL_HANDLERS);
return; disable_signals = hint && (SDL_atoi(hint) == 1);
if (!disable_signals) {
return SDL_QuitInit_Internal();
} }
return 0;
}
static void
SDL_QuitQuit_Internal(void)
{
#ifdef HAVE_SIGACTION #ifdef HAVE_SIGACTION
struct sigaction action; struct sigaction action;
sigaction(SIGINT, NULL, &action); sigaction(SIGINT, NULL, &action);
@ -123,6 +124,14 @@ SDL_QuitQuit(void)
#endif /* HAVE_SIGNAL_H */ #endif /* HAVE_SIGNAL_H */
} }
void
SDL_QuitQuit(void)
{
if (!disable_signals) {
SDL_QuitQuit_Internal();
}
}
/* This function returns 1 if it's okay to close the application window */ /* This function returns 1 if it's okay to close the application window */
int int
SDL_SendQuit(void) SDL_SendQuit(void)