Re: [PATCH] create_directories: simplify and avoid repeated copying

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Geert Bosch <bosch@xxxxxxxx> writes:

> Signed-off-by: Geert Bosch <bosch@xxxxxxxx>
> ---
> I needed to change the logic of this function a bit for
> doing some local hacks^Wmodifications and thought it might
> be a slight improvement/simplification.
> No change in functionality and passed 'make test'.

I like the removal of repeated copying, but I wonder if the
denser condition is really easier to read.

I tried to like it, but I needed to reindent it first, and then
I needed to read it three times to convince myself that they are
equivalent.

        if (errno != EEXIST
            || ((!force || unlink(buf) || mkdir(buf, 0777))
                && (stat(buf, &st) || !S_ISDIR(st.st_mode))) )
                die("cannot create directory at %s", buf);

In the end, I managed to convince myself that this denser
version is doing the same thing as the original, and it is nicer
to see it in only three lines, I am not sure if it is easier to
read anymore, judging from the time it took me to reach that
conclusion...


-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]