The following commit has been merged in the master branch:
commit 0d6e7bc21e645a49a85bd20ca73cdb08f12a9e4f
Author: Guillem Jover <[email protected]>
Date: Fri Feb 4 20:15:17 2011 +0100
dpkg: Refactor conflictor addition to a new push_conflictor() function
Move the conflictor and cflict_index variables to processarc.c and
make them static. And create a new push_conflictor() function to hide
the implementation details. This fixes a warning on variable shadowing.
diff --git a/src/archives.c b/src/archives.c
index 1636174..59f5c51 100644
--- a/src/archives.c
+++ b/src/archives.c
@@ -62,11 +62,6 @@
#include "archives.h"
#include "filters.h"
-#define MAXCONFLICTORS 20
-
-struct pkginfo *conflictor[MAXCONFLICTORS];
-int cflict_index = 0;
-
static inline void
fd_writeback_init(int fd)
{
@@ -1146,12 +1141,8 @@ void check_conflict(struct dependency *dep, struct
pkginfo *pkg,
}
}
if (!pdep) {
- if (cflict_index >= MAXCONFLICTORS)
- ohshit(_("package %s has too many Conflicts/Replaces pairs"),
- pkg->name);
-
/* This conflict is OK - we'll remove the conflictor. */
- conflictor[cflict_index++]= fixbyrm;
+ push_conflictor(pkg, fixbyrm);
varbuf_destroy(&conflictwhy); varbuf_destroy(&removalwhy);
fprintf(stderr, _("dpkg: yes, will remove %s in favour of %s.\n"),
fixbyrm->name, pkg->name);
diff --git a/src/archives.h b/src/archives.h
index 0150086..803aadd 100644
--- a/src/archives.h
+++ b/src/archives.h
@@ -41,8 +41,7 @@ extern struct varbuf fnametmpvb;
extern struct varbuf fnamenewvb;
extern struct pkg_deconf_list *deconfigure;
-extern struct pkginfo *conflictor[];
-extern int cflict_index;
+void push_conflictor(struct pkginfo *pkg, struct pkginfo *pkg_fixbyrm);
void cu_pathname(int argc, void **argv);
void cu_cidir(int argc, void **argv);
diff --git a/src/processarc.c b/src/processarc.c
index bbfa333..0c2d49a 100644
--- a/src/processarc.c
+++ b/src/processarc.c
@@ -157,6 +157,20 @@ deb_verify(const char *filename)
}
}
+#define MAXCONFLICTORS 20
+
+static struct pkginfo *conflictor[MAXCONFLICTORS];
+static int cflict_index = 0;
+
+void
+push_conflictor(struct pkginfo *pkg, struct pkginfo *pkg_fixbyrm)
+{
+ if (cflict_index >= MAXCONFLICTORS)
+ ohshit(_("package %s has too many Conflicts/Replaces pairs"), pkg->name);
+
+ conflictor[cflict_index++] = pkg_fixbyrm;
+}
+
void process_archive(const char *filename) {
static const struct tar_operations tf = {
.read = tarfileread,
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]