[git commit] brctl: code shrink

Denys Vlasenko vda.linux at googlemail.com
Tue Oct 15 10:31:54 UTC 2019


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

function                                             old     new   delta
show_bridge                                          323     317      -6
brctl_main                                          2171    2164      -7
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-13)             Total: -13 bytes
   text	   data	    bss	    dec	    hex	filename
1002083	    551	   5612	1008246	  f6276	busybox_old
1002065	    551	   5612	1008228	  f6264	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 networking/brctl.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/networking/brctl.c b/networking/brctl.c
index 8ed9d2096..25640246d 100644
--- a/networking/brctl.c
+++ b/networking/brctl.c
@@ -157,7 +157,8 @@ static int show_bridge(const char *name, int need_hdr)
 		strcpy(filedata, "yes");
 	fputs(filedata, stdout);
 
-	strcpy(sfx - (sizeof("bridge/")-1), "brif");
+	/* sfx points past "BR/bridge/", turn it into "BR/brif": */
+	sfx[-4] = 'f'; sfx[-3] = '\0';
 	tabs = 0;
 	ifaces = opendir(pathbuf);
 	if (ifaces) {
@@ -472,8 +473,8 @@ static void show_bridge_stp(const char *name)
 	{
 		DIR *ifaces;
 
-		/* sfx points past "BR/bridge/", turn it to "BR/brif": */
-		strcpy(sfx - 4, "f");
+		/* sfx points past "BR/bridge/", turn it into "BR/brif": */
+		sfx[-4] = 'f'; sfx[-3] = '\0';
 		ifaces = opendir(pathbuf);
 		if (ifaces) {
 			struct dirent *ent;


More information about the busybox-cvs mailing list