some reformatting

Replace some
  (foo &&
   bar)
that had crept back into the code with
  (foo
   && bar)
to match the reformatting which took place before 3.6.0.  There are a
couple of lines ending in '||' still present but they look intentional.
isaac64.c has some trailing '|' bit operators that could/should be
moved to the start of the next line but I didn't touch that file.

While in the affected files, I tried to shorten most overly wide lines
(the right margin is supposed to at column 78 and there are quite a
few lines which are 79 characters long, but I left most of those
rather than introduce new line splits).  Also replace a handful of
tabs with spaces.  I was a little surprised not find any trailing
spaces (in the dozen or so files being updated).  I didn't look for
trailing arithmetic or '?'/':' operators which aught to be moved to
the start of the next line.
This commit is contained in:
PatR
2021-12-14 07:43:40 -08:00
parent d0197bd3e7
commit 495cda17b7
13 changed files with 212 additions and 141 deletions

View File

@@ -197,7 +197,12 @@ static NHFILE *viable_nhfile(NHFILE *);
* "This%20is%20a%20%25%20test%21"
*/
char *
fname_encode(const char *legal, char quotechar, char *s, char *callerbuf, int bufsz)
fname_encode(
const char *legal,
char quotechar,
char *s,
char *callerbuf,
int bufsz)
{
char *sp, *op;
int cnt = 0;
@@ -364,8 +369,8 @@ validate_prefix_locations(char *reasonbuf)
if (!(details = strerror(errno)))
#endif
details = "";
Sprintf(panicbuf2, "\"%s\", (%d) %s", g.fqn_prefix[prefcnt], errno,
details);
Sprintf(panicbuf2, "\"%s\", (%d) %s",
g.fqn_prefix[prefcnt], errno, details);
paniclog(panicbuf1, panicbuf2);
failcount++;
}
@@ -513,8 +518,8 @@ create_levelfile(int lev, char errbuf[])
if (nhfp) {
nhfp->ftype = NHF_LEVELFILE;
nhfp->mode = WRITING;
nhfp->structlevel = TRUE; /* do set this TRUE for levelfiles */
nhfp->fieldlevel = FALSE; /* don't set this TRUE for levelfiles */
nhfp->structlevel = TRUE; /* do set this TRUE for levelfiles */
nhfp->fieldlevel = FALSE; /* don't set this TRUE for levelfiles */
nhfp->addinfo = FALSE;
nhfp->style.deflt = FALSE;
nhfp->style.binary = TRUE;
@@ -524,7 +529,8 @@ create_levelfile(int lev, char errbuf[])
/* Use O_TRUNC to force the file to be shortened if it already
* exists and is currently longer.
*/
nhfp->fd = open(fq_lock, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, FCMASK);
nhfp->fd = open(fq_lock, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
FCMASK);
#else
#ifdef MAC
nhfp->fd = maccreat(fq_lock, LEVL_TYPE);
@@ -536,7 +542,8 @@ create_levelfile(int lev, char errbuf[])
if (nhfp->fd >= 0)
g.level_info[lev].flags |= LFILE_EXISTS;
else if (errbuf) /* failure explanation */
Sprintf(errbuf, "Cannot create file \"%s\" for level %d (errno %d).",
Sprintf(errbuf,
"Cannot create file \"%s\" for level %d (errno %d).",
g.lock, lev, errno);
}
nhfp = viable_nhfile(nhfp);
@@ -556,8 +563,8 @@ open_levelfile(int lev, char errbuf[])
nhfp = new_nhfile();
if (nhfp) {
nhfp->mode = READING;
nhfp->structlevel = TRUE; /* do set this TRUE for levelfiles */
nhfp->fieldlevel = FALSE; /* do not set this TRUE for levelfiles */
nhfp->structlevel = TRUE; /* do set this TRUE for levelfiles */
nhfp->fieldlevel = FALSE; /* do not set this TRUE for levelfiles */
nhfp->addinfo = FALSE;
nhfp->style.deflt = FALSE;
nhfp->style.binary = TRUE;
@@ -576,7 +583,8 @@ open_levelfile(int lev, char errbuf[])
settle for `lock' instead of `fq_lock' because the latter
might end up being too big for nethack's BUFSZ */
if (nhfp->fd < 0 && errbuf)
Sprintf(errbuf, "Cannot open file \"%s\" for level %d (errno %d).",
Sprintf(errbuf,
"Cannot open file \"%s\" for level %d (errno %d).",
g.lock, lev, errno);
}
nhfp = viable_nhfile(nhfp);
@@ -890,8 +898,7 @@ set_savefile_name(boolean regularize_it)
if (strlen(g.SAVEP) < (SAVESIZE - 1))
Strcpy(g.SAVEF, g.SAVEP);
if (strlen(g.SAVEF) < (SAVESIZE - 1))
(void) strncat(g.SAVEF, g.plname,
(SAVESIZE - strlen(g.SAVEF)));
(void) strncat(g.SAVEF, g.plname, (SAVESIZE - strlen(g.SAVEF)));
#endif
#if defined(MICRO) && !defined(VMS) && !defined(WIN32) && !defined(MSDOS)
if (strlen(g.SAVEP) < (SAVESIZE - 1))
@@ -1015,7 +1022,8 @@ create_savefile(void)
}
if (nhfp->structlevel) {
#if defined(MICRO) || defined(WIN32)
nhfp->fd = open(fq_save, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, FCMASK);
nhfp->fd = open(fq_save, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC,
FCMASK);
#else
#ifdef MAC
nhfp->fd = maccreat(fq_save, SAVE_TYPE);
@@ -1229,8 +1237,8 @@ get_saved_games(void)
fq_new_save = fqname(g.SAVEF, SAVEPREFIX, 0);
fq_old_save = fqname(files[i], SAVEPREFIX, 1);
if(strcmp(fq_old_save, fq_new_save) != 0 &&
!file_exists(fq_new_save))
if (strcmp(fq_old_save, fq_new_save) != 0
&& !file_exists(fq_new_save))
rename(fq_old_save, fq_new_save);
result[j++] = r;
@@ -2927,7 +2935,8 @@ config_erradd(const char *buf)
if (!g.program_state.config_error_ready) {
/* either very early, where pline() will use raw_print(), or
player gave bad value when prompted by interactive 'O' command */
pline("%s%s.", !iflags.window_inited ? "config_error_add: " : "", buf);
pline("%s%s.", !iflags.window_inited ? "config_error_add: " : "",
buf);
wait_synch();
return;
}
@@ -3445,7 +3454,7 @@ read_sym_file(int which_set)
clear_symsetentry(which_set, TRUE);
config_error_done();
/* If name was defined, it was invalid... Then we're loading fallback */
/* If name was defined, it was invalid. Then we're loading fallback */
if (g.symset[which_set].name) {
g.symset[which_set].explicitly = FALSE;
return 0;
@@ -4340,7 +4349,7 @@ reveal_paths(void)
if (strlen(pd) > 0) {
raw_printf("portable_device_paths (set in sysconf):");
raw_printf(" \"%s\"", pd);
}
}
}
#endif