2010/10/20 Alexander Shishkin <[email protected]>: > On Wed, Oct 20, 2010 at 04:36:48 +0200, Denys Vlasenko wrote: >> 2010/10/20 Alexander Shishkin <[email protected]>: >> > On Wed, Oct 20, 2010 at 01:26:24 +0200, Denys Vlasenko wrote: >> >> On Wed, Oct 20, 2010 at 2:56 AM, Alexander Shishkin <[email protected]> >> >> wrote: >> >> > How about this? (I left locking in place but applied other changes) >> >> > >> >> > function old new delta >> >> > add_shell_main - 497 +497 >> >> > .rodata 144696 144795 +99 >> >> > packed_usage 27078 27114 +36 >> >> > applet_names 2259 2282 +23 >> >> > applet_main 2672 2688 +16 >> >> > applet_nameofs 668 672 +4 >> >> > applet_install_loc 167 168 +1 >> >> > ------------------------------------------------------------------------------ >> >> > (add/remove: 2/0 grow/shrink: 6/0 up/down: 676/0) Total: >> >> > 676 bytes >> >> >> >> 676 bytes is far too much for a simple pass over a text file. >> >> >> >> How about this? >> >> >> >> http://git.busybox.net/busybox/commit/?id=5be79ff27a5852567a9bdec80d67b061ad828290 >> > >> > Well, the list version is more readable, imo. >> >> It's twice as big. >> >> > Also, splitting add and remove >> > into separate options seems quite pointless. >> >> What if I want one-applet version of add-shell? >> (.config with only one enabled has optimizations >> which skip applet table search, and therefore >> there is no applet table in the first place. etc...) > > If you want to add shells, you want to remove them as well. Where there is > addition, there is subtraction, I used to think. > >> > And I'm totally missing the point >> > of using stdout, but I'm sure there must be a good reason. >> >> How can you do O_EXCL open with fopen? > > No problem with xopen(), but why xmovefd()?
No particular reason. Can alternatively do new_fp = xfdopen(xopen(fn, O_WRONLY | O_TRUNC | O_EXCL), "w"); and use new_fp instead of stdout, or use write(fd, str, strlen(str)) on xopen's fd. If any of those approaches result in smaller code, then I'll surely take a patch to implement them. -- vda _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
