PERFORCE change 182218 for review
Julien Laffaye
jlaffaye at skunkworks.freebsd.org
Wed Aug 11 18:26:25 UTC 2010
http://p4web.freebsd.org/@@182218?ac=10
Change 182218 by jlaffaye at jlaffaye-chulak on 2010/08/10 20:04:01
Remove useless globals.
Affected files ...
.. //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/add/extract.c#16 edit
.. //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/add/perform.c#15 edit
Differences ...
==== //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/add/extract.c#16 (text+ko) ====
@@ -31,10 +31,8 @@
#include "add.h"
-/* Globals used by cleanup() */
-int extract_state;
-char db_dir_tmp[FILENAME_MAX];
-char db_dir[FILENAME_MAX];
+/* Global used by cleanup() */
+char db_dir_tmp[FILENAME_MAX];
/*
* Extract and parse the plist of a package archive.
@@ -90,6 +88,7 @@
Boolean conflictsfound = FALSE;
int code = 0;
int errcode = 0;
+ char db_dir[FILENAME_MAX];
char cmd[FILENAME_MAX];
char pre_script[FILENAME_MAX] = INSTALL_FNAME;
char post_script[FILENAME_MAX];
@@ -102,7 +101,7 @@
struct stat sb;
/* Nothing to cleanup yet */
- extract_state = 0;
+ db_dir_tmp[0] = '\0';
/*
* If we have a prefix, delete the first one we see and add this
@@ -289,7 +288,7 @@
printf("%s added successfully\n", p->name);
}
/* pkg_do() modified this global, so reset it */
- extract_state = 0;
+ db_dir_tmp[0] = '\0';
}
/* XXX: WTF is this logic ? */
else {
@@ -324,8 +323,6 @@
warnx("Can not create '%s' directory - aborting", db_dir_tmp);
return (1);
}
- /* Tell cleanup that we have a temporary dir in LOG_DIR */
- extract_state = 1;
if (chdir(db_dir_tmp) == -1) {
warn("chdir(%s) - aborting", db_dir_tmp);
vsystem("%s -rf %s", REMOVE_CMD, db_dir_tmp);
@@ -629,7 +626,7 @@
if (rename(db_dir_tmp, db_dir) == -1)
warn("Can not rename '%s' to '%s'", db_dir_tmp, db_dir);
else {
- extract_state = 0;
+ db_dir_tmp[0] = '\0';
if (Verbose)
printf("Package %s registered in %s\n", pkg->name, db_dir);
}
==== //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/add/perform.c#15 (text+ko) ====
@@ -150,6 +150,6 @@
void
cleanup(void)
{
- if (extract_state == 1)
+ if (db_dir_tmp[0] != '\0')
vsystem("%s -rf %s", REMOVE_CMD, db_dir_tmp);
}
More information about the p4-projects
mailing list