[PATCH 1/1] diff: the_same file checking fix

Stefan Seyfried stefan.seyfried at googlemail.com
Fri Mar 25 21:24:47 UTC 2011


On Fri, 25 Mar 2011 12:31:05 +0300
Roman Borisov <ext-roman.borisov at nokia.com> wrote:

> +	/* Compare stats to check if the files are the same physically;
> +	   See diffutils: src/system.h for full description */
> +	if (stb[0].st_ino == stb[1].st_ino && 
> +		stb[0].st_dev == stb[1].st_dev &&
> +		stb[0].st_mode == stb[1].st_mode &&
> +		stb[0].st_nlink == stb[1].st_nlink &&
> +		stb[0].st_uid == stb[1].st_uid &&
> +		stb[0].st_gid == stb[1].st_gid &&
> +		stb[0].st_size == stb[1].st_size &&
> +		stb[0].st_mtime == stb[1].st_mtime &&
> +		stb[0].st_ctime == stb[1].st_ctime) {
> +		/* files are physically the same; no need to compare them */
> +		return STATUS_SAME;
> +	}

Just wondering, did not test: couldn't you just memcmp stb[0] and stb[1]?
How would that affect code size?
-- 
Stefan Seyfried

"Dispatch war rocket Ajax to bring back his body!"


More information about the busybox mailing list