The comma operator is a somewhat obscure C feature that is often used by
mistake and can even cause unintentional code flow. In this instance, it
makes the code harder to read than necessary, too. Better use a
semicolon instead.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
mkdir(dest, dest_mode);
cl_assert_(source_dir = opendir(source), "Could not open source dir");
- while ((d = (errno = 0, readdir(source_dir))) != NULL) {
+ for (;;) {
char *child;
+ errno = 0;
+ if ((d = readdir(source_dir)) == NULL)
+ break;
if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
continue;
struct dirent *d;
cl_assert_(dir = opendir(path), "Could not open dir");
- while ((d = (errno = 0, readdir(dir))) != NULL) {
+ for (;;) {
char *child;
+ errno = 0;
+ if ((d = readdir(dir)) == NULL)
+ break;
if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
continue;