From ce2c0cc30f07d2bbd4b645666a779185797c25a3 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Mon, 19 Apr 2021 23:58:25 +0700 Subject: [PATCH] force M_SaveDefaults() to always write the help string (#168) * force M_SaveDefaults() to always write the help string * fix gcc build * add comment --- Source/m_misc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/m_misc.c b/Source/m_misc.c index bfc1008e..a1df77de 100644 --- a/Source/m_misc.c +++ b/Source/m_misc.c @@ -1983,7 +1983,7 @@ void M_SaveDefaults (void) { char tmpfile[PATH_MAX+1]; register default_t *dp; - int line, blanks; + int blanks; FILE *f; // killough 10/98: for when exiting early @@ -2009,11 +2009,14 @@ void M_SaveDefaults (void) // killough 10/98: output comment lines which were read in during input - for (blanks = 1, line = 0, dp = defaults; ; dp++, blanks = 0) + for (blanks = 1, dp = defaults; ; dp++, blanks = 0) { int brackets = 0; config_t value; + // Always write a help string to avoid + // incorrect entries in the user config +/* for (;line < comment && comments[line].line <= dp-defaults; line++) if (*comments[line].text != '[' || (brackets = 1, config_help)) @@ -2026,6 +2029,7 @@ void M_SaveDefaults (void) putc('\n',f) == EOF)) || fputs(comments[line].text, f) == EOF) goto error; +*/ // If we still haven't seen any blanks, // Output a blank line for separation