Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Apr 2010 20:57:17 GMT
From:      Garrett Cooper <gcooper@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 176817 for review
Message-ID:  <201004112057.o3BKvH02007856@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@176817?ac=10

Change 176817 by gcooper@gcooper-bayonetta on 2010/04/11 20:57:00

	Simplify code a bit.
	
	- archive_read_data_skip call is unneeded because we're doing an in-order
	  traversal of the archive anyhow.
	- Thus, there's no reason why we should save the value of fnmatch(3) because
	  we're not reusing it anywhere else.
	- Fix indentation on multiline branch statement.

Affected files ...

.. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/lib/file.c#7 edit

Differences ...

==== //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/lib/file.c#7 (text+ko) ====

@@ -348,7 +348,7 @@
 	Boolean extract_whole_archive = FALSE;
 	const char *error = NULL;
 	const char *pkg_name_humanized;
-	int fn_ret = 0, r;
+	int r;
 
 	if (file_expr == NULL || strcmp("*", file_expr) == 0)
 		extract_whole_archive = TRUE;
@@ -374,8 +374,8 @@
 
 			/* Let's extract the whole archive, or just a file. */
 			if (extract_whole_archive == TRUE ||
-			    (fn_ret = fnmatch(file_expr,
-			     archive_entry_pathname(archive_entry),
+			    (fnmatch(file_expr,
+			         archive_entry_pathname(archive_entry),
 			         FNM_PATHNAME) == 0)) {
 
 				r = archive_read_extract(archive, archive_entry,
@@ -389,13 +389,6 @@
 
 			}
 
-			/*
-			 * Else let's skip the entry because we still haven't
-			 * found what we're looking for.
-			 */
-			else if (fn_ret == FNM_NOMATCH)
-				archive_read_data_skip(archive);
-
 		}
 
 	archive_read_finish(archive);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201004112057.o3BKvH02007856>