[git commit] touch: code shrink

Denys Vlasenko vda.linux at googlemail.com
Wed Apr 14 12:46:35 UTC 2021


commit: https://git.busybox.net/busybox/commit/?id=d156bcf71eb62f4e240e45cb2b84bb4eeb6a1e64
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
touch_main                                           424     421      -3

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 coreutils/touch.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/coreutils/touch.c b/coreutils/touch.c
index 4c7362acd..a7907e2c8 100644
--- a/coreutils/touch.c
+++ b/coreutils/touch.c
@@ -156,12 +156,10 @@ int touch_main(int argc UNUSED_PARAM, char **argv)
 	/* If both -a and -m specified, both times should be set.
 	 * IOW: set OMIT only if one, not both, of them is given!
 	 */
-	if ((opts & (OPT_a|OPT_m)) != (OPT_a|OPT_m)) {
-		if (opts & OPT_a)
-			timebuf[1].tv_nsec = UTIME_OMIT;
-		if (opts & OPT_m)
-			timebuf[0].tv_nsec = UTIME_OMIT;
-	}
+	if ((opts & (OPT_a|OPT_m)) == OPT_a)
+		timebuf[1].tv_nsec = UTIME_OMIT;
+	if ((opts & (OPT_a|OPT_m)) == OPT_m)
+		timebuf[0].tv_nsec = UTIME_OMIT;
 
 	argv += optind;
 	do {


More information about the busybox-cvs mailing list