[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH 2/1] readlink: slight size optimization
From:       Eric Blake <eblake () redhat ! com>
Date:       2023-03-30 13:05:23
Message-ID: 20230330130523.56401-1-eblake () redhat ! com
[Download RAW message or body]

Exploit the value of the flag for -n to reduce the compiled size of
readlink_main() from 79 to 76 bytes on x86_64.

Signed-off-by: Eric Blake <eblake@redhat.com>
---
 coreutils/readlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/coreutils/readlink.c b/coreutils/readlink.c
index 0a9aa957e..83c417e66 100644
--- a/coreutils/readlink.c
+++ b/coreutils/readlink.c
@@ -88,8 +88,8 @@ int readlink_main(int argc UNUSED_PARAM, char **argv)

 	if (!buf)
 		return EXIT_FAILURE;
-	printf((opt & 1) ? "%s" : "%s\n", buf);
+	printf("%s%s", buf, "\n"[opt & 1]);
 	free(buf);

 	fflush_stdout_and_exit_SUCCESS();

-- 
2.39.2

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic