[patch] minor size optimization for swaponoff.c
Bernhard Fischer
rep.nop at aon.at
Sat Mar 18 09:33:21 PST 2006
Hi,
Another very minor size tweak..
text data bss dec hex filename
314 0 0 314 13a swaponoff.o.orig
310 0 0 310 136 swaponoff.o
Intended for trunk after the busybox_1_1_stable branch was created.
-------------- next part --------------
Index: util-linux/swaponoff.c
===================================================================
--- util-linux/swaponoff.c (revision 14552)
+++ util-linux/swaponoff.c (working copy)
@@ -30,10 +30,7 @@
if (st.st_blocks * 512 < st.st_size)
bb_error_msg_and_die("swap file has holes");
- if (bb_applet_name[5] == 'n')
- status = swapon(device, 0);
- else
- status = swapoff(device);
+ status = (bb_applet_name[5] == 'n') ? swapon(device, 0) : swapoff(device);
if (status != 0) {
bb_perror_msg("%s", device);
@@ -71,12 +68,9 @@
if (argc == 1)
bb_show_usage();
-
- ret = bb_getopt_ulflags(argc, argv, "a");
- if (ret & DO_ALL)
+ if ((bb_getopt_ulflags(argc, argv, "a")) > 0)
return do_em_all();
- ret = 0;
while (*++argv)
ret += swap_enable_disable(*argv);
return ret;
More information about the busybox
mailing list