Skip to content

Commit

Permalink
Patched to compile on C89 compilers.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Mar 24, 2015
1 parent 672ccb4 commit 3f9f002
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions src/events/SDL_quit.c
Expand Up @@ -46,15 +46,9 @@ SDL_HandleSIG(int sig)
#endif /* HAVE_SIGNAL_H */

/* Public functions */
int
SDL_QuitInit(void)
static int
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
struct sigaction action;
sigaction(SIGINT, NULL, &action);
Expand Down Expand Up @@ -92,13 +86,20 @@ SDL_QuitInit(void)
return 0;
}

void
SDL_QuitQuit(void)
int
SDL_QuitInit(void)
{
if (disable_signals) {
return;
const char *hint = SDL_GetHint(SDL_HINT_NO_SIGNAL_HANDLERS);
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
struct sigaction action;
sigaction(SIGINT, NULL, &action);
Expand All @@ -123,6 +124,14 @@ SDL_QuitQuit(void)
#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 */
int
SDL_SendQuit(void)
Expand Down

0 comments on commit 3f9f002

Please sign in to comment.