split DUMPLOG

DUMPLOG requests the DUMPLOG feature as it does now
DUMPLOG_CORE requests the internal buffering only (used for CRASHREPORT)

This allows CRASHREPORT to access recent messages without performing
any file I/O.
This commit is contained in:
nhkeni
2024-02-20 21:37:06 -05:00
parent e76ab9558f
commit 3f5d1d3a36
14 changed files with 30 additions and 26 deletions

View File

@@ -962,7 +962,7 @@ void NetHackQtBind::qt_putmsghistory(const char *msg, boolean is_restoring)
if (msg) {
//raw_printf("msg='%s'", msg);
window->PutStr(ATR_NONE, QString::fromLatin1(msg));
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
dumplogmsg(msg);
#endif
} else if (msgs_saved) {
@@ -970,7 +970,7 @@ void NetHackQtBind::qt_putmsghistory(const char *msg, boolean is_restoring)
for (int i = 0; i < msgs_strings->size(); ++i) {
const QString &nxtmsg = msgs_strings->at(i);
window->PutStr(ATR_NONE, nxtmsg);
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
dumplogmsg(nxtmsg.toLatin1().constData());
#endif
}

View File

@@ -1044,7 +1044,7 @@ curses_putmsghistory(const char *msg, boolean restoring_msghist)
stash_head = first_mesg, first_mesg = (nhprev_mesg *) 0;
last_mesg = (nhprev_mesg *) 0; /* no need to remember the tail */
initd = TRUE;
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
/* this suffices; there's no need to scrub g.saved_pline[] pointers */
gs.saved_pline_index = 0;
#endif
@@ -1058,7 +1058,7 @@ curses_putmsghistory(const char *msg, boolean restoring_msghist)
and those messages should have a normal turn value */
if (last_mesg) /* appease static analyzer */
last_mesg->turn = restoring_msghist ? (1L << 3) : gh.hero_seq;
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
dumplogmsg(last_mesg->str);
#endif
} else if (stash_count) {
@@ -1081,7 +1081,7 @@ curses_putmsghistory(const char *msg, boolean restoring_msghist)
/* added line became new tail */
if (last_mesg) /* appease static analyzer */
last_mesg->turn = mesg_turn;
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
dumplogmsg(mesg->str);
#endif
free((genericptr_t) mesg->str);

View File

@@ -214,7 +214,7 @@ hooked_tty_getlin(
/* prevent next message from pushing current query+answer into
tty message history */
*gt.toplines = '\0';
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
} else {
/* needed because we've bypassed pline() */
dumplogmsg(gt.toplines);

View File

@@ -534,7 +534,7 @@ tty_yn_function(
(void) key2txt(q, rtmp);
/* addtopl(rtmp); -- rewrite gt.toplines instead */
Sprintf(gt.toplines, "%s%s", prompt, rtmp);
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
dumplogmsg(gt.toplines);
#endif
ttyDisplay->inread--;
@@ -684,7 +684,7 @@ tty_putmsghistory(const char *msg, boolean restoring_msghist)
restored ones are being put into place */
msghistory_snapshot(TRUE);
initd = TRUE;
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
/* this suffices; there's no need to scrub saved_pline[] pointers */
gs.saved_pline_index = 0;
#endif
@@ -701,7 +701,7 @@ tty_putmsghistory(const char *msg, boolean restoring_msghist)
/* move most recent message to history, make this become most recent */
remember_topl();
Strcpy(gt.toplines, msg);
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
dumplogmsg(gt.toplines);
#endif
} else if (snapshot_mesgs) {
@@ -712,7 +712,7 @@ tty_putmsghistory(const char *msg, boolean restoring_msghist)
for (idx = 0; snapshot_mesgs[idx]; ++idx) {
remember_topl();
Strcpy(gt.toplines, snapshot_mesgs[idx]);
#ifdef DUMPLOG
#ifdef DUMPLOG_CORE
dumplogmsg(gt.toplines);
#endif
}