diff options
author | Bardur Arantsson <bardur@scientician.net> | 2014-12-15 20:55:24 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2014-12-15 20:55:24 +0100 |
commit | 63dc88888692fbeddb4c0a2ec99af3cd708276eb (patch) | |
tree | 816e380c679b79f421419c89af154a234a6ee48a /src | |
parent | 87e166812794559b13741c70e1de5d3280a3ff17 (diff) |
Remove core() and core_aux
Invoking undefined behavior is not the correct way to
get a core dump. Plus there's only a single caller,
only used in truly bizarre circumstances.
Diffstat (limited to 'src')
-rw-r--r-- | src/main-gcu.c | 1 | ||||
-rw-r--r-- | src/main-gtk2.c | 1 | ||||
-rw-r--r-- | src/main-win.c | 1 | ||||
-rw-r--r-- | src/util.cc | 5 | ||||
-rw-r--r-- | src/z-util.c | 32 | ||||
-rw-r--r-- | src/z-util.h | 5 |
6 files changed, 3 insertions, 42 deletions
diff --git a/src/main-gcu.c b/src/main-gcu.c index f97ca596..8ba2c8ec 100644 --- a/src/main-gcu.c +++ b/src/main-gcu.c @@ -936,7 +936,6 @@ errr init_gcu(int argc, char **argv) /* Activate hooks */ quit_aux = hook_quit; - core_aux = hook_quit; /* Require standard size screen */ if ((LINES < 24) || (COLS < 80)) diff --git a/src/main-gtk2.c b/src/main-gtk2.c index 6e5fff7e..5f6dae12 100644 --- a/src/main-gtk2.c +++ b/src/main-gtk2.c @@ -1923,7 +1923,6 @@ errr init_gtk2(int argc, char **argv) /* Activate hooks - Use gtk/glib interface throughout */ quit_aux = hook_quit; - core_aux = hook_quit; /* Parse args */ for (i = 1; i < argc; i++) diff --git a/src/main-win.c b/src/main-win.c index 368804be..67fca325 100644 --- a/src/main-win.c +++ b/src/main-win.c @@ -3290,7 +3290,6 @@ int FAR PASCAL WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, /* Temporary hooks */ plog_aux = hack_plog; quit_aux = hack_quit; - core_aux = hack_quit; /* Prepare the filepaths */ init_stuff(); diff --git a/src/util.cc b/src/util.cc index 37e9f7d0..da94f171 100644 --- a/src/util.cc +++ b/src/util.cc @@ -61,8 +61,9 @@ int *no_fds = NULL; /* Paranoia -- No excessive sleeping */ - if (usecs > 4000000L) core("Illegal usleep() call"); - + if (usecs > 4000000L) { + usecs = 4000000L; + } /* Wait for it */ Timer.tv_sec = (usecs / 1000000L); diff --git a/src/z-util.c b/src/z-util.c index 4c59f793..0304a1da 100644 --- a/src/z-util.c +++ b/src/z-util.c @@ -106,35 +106,3 @@ void quit(cptr str) /* Failure */ (void)(exit( -1)); } - - - -/* - * Redefinable "core" action - */ -void (*core_aux)(cptr) = NULL; - -/* - * Dump a core file, after printing a warning message - * As with "quit()", try to use the "core_aux()" hook first. - */ -void core(cptr str) -{ - char *crash = NULL; - - /* Use the aux function */ - if (core_aux) (*core_aux)(str); - - /* Dump the warning string */ - if (str) plog(str); - - /* Attempt to Crash */ - (*crash) = (*crash); - - /* Be sure we exited */ - quit("core() failed"); -} - - - - diff --git a/src/z-util.h b/src/z-util.h index e9bbf873..914a64e7 100644 --- a/src/z-util.h +++ b/src/z-util.h @@ -15,7 +15,6 @@ extern "C" { /* Aux functions */ extern void (*plog_aux)(cptr); extern void (*quit_aux)(cptr); -extern void (*core_aux)(cptr); /**** Available Functions ****/ @@ -36,10 +35,6 @@ extern void plog(cptr str); /* Exit, with optional message */ extern void quit(cptr str); -/* Dump core, with optional message */ -extern void core(cptr str); - - #ifdef __cplusplus } /* extern "C" */ |