~smlavine/navipage

ed7cfaaaf5ca86dc6c42688f7256c6d19dacc376 — Sebastian LaVine 2 months ago dcd69d6
Use parentheses around usages of comma operator

Without the parentheses, at a glance these statements may look like they
just say `return ewarn(...)`, and the actual value being returned isn't
noticed. The presence of parentheses brings attention to the end of the
line.
1 files changed, 4 insertions(+), 4 deletions(-)

M main.c
M main.c => main.c +4 -4
@@ 195,7 195,7 @@ add_directory(const char *const path, const int recurse)
	char *newpath;

	if ((dirp = opendir(path)) == NULL)
		return ewarn("cannot opendir %s", path), -1;
		return (ewarn("cannot opendir %s", path), -1);

	/* Reset errno in order to detect readdir/closedir errors. */
	errno = 0;


@@ 218,7 218,7 @@ add_directory(const char *const path, const int recurse)
		free(newpath);
	}
	if (errno != 0)
		return ewarn("cannot readdir %s", path), -1;
		return (ewarn("cannot readdir %s", path), -1);

	closedir(dirp);



@@ 239,14 239,14 @@ add_path(const char *path, const int recurse)
	struct stat statbuf;

	if (stat(path, &statbuf) == -1)
		return ewarn("cannot stat %s", path), -1;
		return (ewarn("cannot stat %s", path), -1);

	if (S_ISDIR(statbuf.st_mode))
		return recurse ? add_directory(path, recurse) :
			(warn("no -r; omitting directory %s\n", path), -1);

	if (!S_ISREG(statbuf.st_mode))
		return warn("cannot read %s: not a regular file\n", path), -1;
		return (warn("cannot read %s: not a regular file\n", path), -1);

	/* Add file path to the list. */