PERFORCE change 79565 for review

Christian S.J. Peron csjp at FreeBSD.org
Mon Jul 4 16:32:42 GMT 2005


http://perforce.freebsd.org/chv.cgi?CH=79565

Change 79565 by csjp at csjp_xor on 2005/07/04 16:32:16

	-Implement strsep loop optimization to prevent a second
	 walk of the dependency list.
	-Remove un-used variables

Affected files ...

.. //depot/projects/trustedbsd/mac/usr.sbin/getfhash/getfhash.c#11 edit

Differences ...

==== //depot/projects/trustedbsd/mac/usr.sbin/getfhash/getfhash.c#11 (text+ko) ====

@@ -142,8 +142,8 @@
 static void
 process_depends(const char *pathname)
 {
-	char **av, *depends[10], *dependlist;
-	int ndeps, error, i, j;
+	char *av, *dependlist;
+	int error, j;
 	ssize_t nbytes;
 
 	nbytes = extattr_get_file(pathname, MAC_CHKEXEC_ATTRN,
@@ -162,17 +162,14 @@
 	error = extattr_get_file(pathname, MAC_CHKEXEC_ATTRN,
 	    MAC_CHKEXEC_DEP, dependlist, nbytes);
 	dependlist[nbytes] = '\0';
-	for (ndeps = 0, av = depends;
-	    (*av = strsep(&dependlist, ":")) != NULL; ndeps++)
-		if (**av != '\0')
-			if (++av > &depends[10])
-				break;
 	depth++;
-	for (i = 0; i < ndeps; i++) {
+	for (; (av = strsep(&dependlist, ":")) != NULL;) {
+		if (strlen(av) == 0)
+			continue;
 		for (j = 0; j < depth; j++)
 			fputs("    ", stdout);
-		print_hash(depends[i]);
-	}
+		print_hash(av);
+        }
 	depth--;
 }
 
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list