svn commit: trunk/busybox/networking

vda at busybox.net vda at busybox.net
Wed Sep 26 10:46:19 UTC 2007


Author: vda
Date: 2007-09-26 03:46:18 -0700 (Wed, 26 Sep 2007)
New Revision: 20038

Log:
inetd: move struct fields around -> save .25 k of code

function                                             old     new   delta
freeconfig                                            75      76      +1
register_rpc                                         200     196      -4
dupconfig                                            165     159      -6
reapchild                                            173     166      -7
retry                                                 93      82     -11
goaway                                               112     101     -11
getconfigent                                        1241    1222     -19
setup                                                645     592     -53
inetd_main                                          2160    2107     -53
config                                              1602    1518     -84
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/9 up/down: 1/-248)           Total: -247 bytes
   text    data     bss     dec     hex filename
 773951    1038   10332  785321   bfba9 busybox_old
 773703    1038   10332  785073   bfab1 busybox_unstripped



Modified:
   trunk/busybox/networking/inetd.c


Changeset:
Modified: trunk/busybox/networking/inetd.c
===================================================================
--- trunk/busybox/networking/inetd.c	2007-09-26 10:34:54 UTC (rev 20037)
+++ trunk/busybox/networking/inetd.c	2007-09-26 10:46:18 UTC (rev 20038)
@@ -222,6 +222,9 @@
 };
 
 typedef struct servtab_t {
+	/* The most frequently referenced one: */
+	int se_fd;                            /* open descriptor */
+	/* NB: 'biggest fields last' saves on code size (~250 bytes) */
 	char *se_hostaddr;                    /* host address to listen on */
 	char *se_service;                     /* name of service */
 	char *se_proto;                       /* protocol used */
@@ -242,10 +245,14 @@
 #ifdef INETD_FEATURE_ENABLED
 	const struct builtin *se_bi;          /* if built-in, description */
 #endif
+	int se_ctrladdr_size;
+	int se_max;                           /* max # of instances of this service */
+	int se_count;                         /* number started since se_time */
+	struct servtab_t *se_next;
+	struct timeval se_time;               /* start of se_count */
 	char *se_server;                      /* server program */
 #define MAXARGV 20
 	char *se_argv[MAXARGV + 1];           /* program arguments */
-	int se_fd;                            /* open descriptor */
 	union {
 		struct sockaddr se_un_ctrladdr;
 		struct sockaddr_in se_un_ctrladdr_in;
@@ -258,11 +265,6 @@
 #define se_ctrladdr_in  se_un.se_un_ctrladdr_in
 #define se_ctrladdr_in6 se_un.se_un_ctrladdr_in6
 #define se_ctrladdr_un  se_un.se_un_ctrladdr_un
-	int se_ctrladdr_size;
-	int se_max;                           /* max # of instances of this service */
-	int se_count;                         /* number started since se_time */
-	struct timeval se_time;               /* start of se_count */
-	struct servtab_t *se_next;
 } servtab_t;
 
 #ifdef INETD_FEATURE_ENABLED




More information about the busybox-cvs mailing list