svn commit: trunk/busybox/findutils

aldot at busybox.net aldot at busybox.net
Thu Mar 29 13:56:02 UTC 2007


Author: aldot
Date: 2007-03-29 06:56:02 -0700 (Thu, 29 Mar 2007)
New Revision: 18274

Log:
- remove bloated switch statement.
   text    data     bss     dec     hex filename
   2706       1      12    2719     a9f find.o.r18273
   2605       1      12    2618     a3a find.o.r18274


Modified:
   trunk/busybox/findutils/find.c


Changeset:
Modified: trunk/busybox/findutils/find.c
===================================================================
--- trunk/busybox/findutils/find.c	2007-03-29 13:55:17 UTC (rev 18273)
+++ trunk/busybox/findutils/find.c	2007-03-29 13:56:02 UTC (rev 18274)
@@ -295,31 +295,22 @@
 {
 	int mask = 0;
 
-	switch (type[0]) {
-	case 'b':
+	if (*type == 'b')
 		mask = S_IFBLK;
-		break;
-	case 'c':
+	else if (*type == 'c')
 		mask = S_IFCHR;
-		break;
-	case 'd':
+	else if (*type == 'd')
 		mask = S_IFDIR;
-		break;
-	case 'p':
+	else if (*type == 'p')
 		mask = S_IFIFO;
-		break;
-	case 'f':
+	else if (*type == 'f')
 		mask = S_IFREG;
-		break;
-	case 'l':
+	else if (*type == 'l')
 		mask = S_IFLNK;
-		break;
-	case 's':
+	else if (*type == 's')
 		mask = S_IFSOCK;
-		break;
-	}
 
-	if (mask == 0 || type[1] != '\0')
+	if (mask == 0 || *(type + 1) != '\0')
 		bb_error_msg_and_die(bb_msg_invalid_arg, type, "-type");
 
 	return mask;




More information about the busybox-cvs mailing list