MCPcopy Index your code
hub / github.com/NetHack/NetHack / nh_terminate

Function nh_terminate

src/end.c:1673–1703  ·  view source on GitHub ↗

should be called with either EXIT_SUCCESS or EXIT_FAILURE */

Source from the content-addressed store, hash-verified

1671
1672/* should be called with either EXIT_SUCCESS or EXIT_FAILURE */
1673ATTRNORETURN void
1674nh_terminate(int status)
1675{
1676 program_state.in_moveloop = 0; /* won't be returning to normal play */
1677
1678 l_nhcore_call(NHCORE_GAME_EXIT);
1679#ifdef MACOS9
1680 getreturn("to exit");
1681#endif
1682 /* don't bother to try to release memory if we're in panic mode, to
1683 avoid trouble in case that happens to be due to memory problems */
1684 if (!program_state.panicking) {
1685 freedynamicdata();
1686 dlb_cleanup();
1687 l_nhcore_done();
1688 }
1689
1690#ifdef VMS
1691 /*
1692 * This is liable to draw a warning if compiled with gcc, but it's
1693 * more important to flag panic() -> really_done() -> nh_terminate()
1694 * as __noreturn__ then to avoid the warning.
1695 */
1696 /* don't call exit() if already executing within an exit handler;
1697 that would cancel any other pending user-mode handlers */
1698 if (program_state.exiting)
1699 return;
1700#endif
1701 program_state.exiting = 1;
1702 nethack_exit(status);
1703}
1704
1705/* set a delayed killer, ensure non-delayed killer is cleared out */
1706void

Callers 15

initoptionsFunction · 0.70
initoptions_initFunction · 0.70
really_doneFunction · 0.70
execplinehandlerFunction · 0.70
readmailFunction · 0.70
choose_windowsFunction · 0.70
addto_windowchainFunction · 0.70
FreadFunction · 0.70
redirectFunction · 0.70
docompress_fileFunction · 0.70
opt_terminateFunction · 0.70
scores_onlyFunction · 0.70

Calls 6

l_nhcore_callFunction · 0.85
freedynamicdataFunction · 0.85
dlb_cleanupFunction · 0.85
l_nhcore_doneFunction · 0.85
getreturnFunction · 0.50
nethack_exitFunction · 0.50

Tested by

no test coverage detected