Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

PERFORCE change 176817 for review

0 views
Skip to first unread message

Garrett Cooper

unread,
Apr 11, 2010, 4:57:17 PM4/11/10
to Perforce Change Reviews
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);

0 new messages