Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvy Foster <ivy.foster@gmail.com>2016-10-12 15:13:32 -0500
committerAllan McRae <allan@archlinux.org>2016-10-22 20:50:55 +1000
commitfa06951d90fee028ece95fc7caab39fc7d35d55f (patch)
tree7bdda990838eb07f2adf5b64b7965c2dcd51cad9 /src
parenta55adb81d0f6fcd7fe98cc444806b3b0d25efc9c (diff)
Represent bitfields as ints, not enums
Many bitfield variables are declared to be enums, because they are generated using bitwise operations on enums such. However, their actual values aren't necessary members of their parent enum, so declaring them 'int' is more accurate. Signed-off-by: Ivy Foster <ivy.foster@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/conf.c17
-rw-r--r--src/pacman/conf.h24
-rw-r--r--src/pacman/package.c2
-rw-r--r--src/pacman/sync.c2
-rw-r--r--src/pacman/upgrade.c8
-rw-r--r--src/pacman/util.c2
-rw-r--r--src/pacman/util.h3
-rw-r--r--src/util/cleanupdelta.c4
-rw-r--r--src/util/testpkg.c4
9 files changed, 34 insertions, 32 deletions
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 25de7afa..d8d64fb0 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -325,10 +325,10 @@ int config_set_arch(const char *arch)
* @param linenum current line number in file
* @return 0 on success, 1 on any parsing error
*/
-static int process_siglevel(alpm_list_t *values, alpm_siglevel_t *storage,
- alpm_siglevel_t *storage_mask, const char *file, int linenum)
+static int process_siglevel(alpm_list_t *values, int *storage,
+ int *storage_mask, const char *file, int linenum)
{
- alpm_siglevel_t level = *storage, mask = *storage_mask;
+ int level = *storage, mask = *storage_mask;
alpm_list_t *i;
int ret = 0;
@@ -421,13 +421,12 @@ static int process_siglevel(alpm_list_t *values, alpm_siglevel_t *storage,
}
/**
- * Merge the package entires of two signature verification levels.
+ * Merge the package entries of two signature verification levels.
* @param base initial siglevel
- * @param over overridden siglevel
+ * @param over overriding siglevel
* @return merged siglevel
*/
-static alpm_siglevel_t merge_siglevel(alpm_siglevel_t base,
- alpm_siglevel_t over, alpm_siglevel_t mask)
+static int merge_siglevel(int base, int over, int mask)
{
return mask ? (over & mask) | (base & ~mask) : over;
}
@@ -845,11 +844,11 @@ struct section_t {
int depth;
};
-static int process_usage(alpm_list_t *values, alpm_db_usage_t *usage,
+static int process_usage(alpm_list_t *values, int *usage,
const char *file, int linenum)
{
alpm_list_t *i;
- alpm_db_usage_t level = *usage;
+ int level = *usage;
int ret = 0;
for(i = values; i; i = i->next) {
diff --git a/src/pacman/conf.h b/src/pacman/conf.h
index 2ddeadb3..945de7ce 100644
--- a/src/pacman/conf.h
+++ b/src/pacman/conf.h
@@ -37,9 +37,9 @@ typedef struct __colstr_t {
typedef struct __config_repo_t {
char *name;
alpm_list_t *servers;
- alpm_db_usage_t usage;
- alpm_siglevel_t siglevel;
- alpm_siglevel_t siglevel_mask;
+ int usage;
+ int siglevel;
+ int siglevel_mask;
} config_repo_t;
typedef struct __config_t {
@@ -95,14 +95,16 @@ typedef struct __config_t {
unsigned short group;
unsigned short noask;
unsigned int ask;
- alpm_transflag_t flags;
- alpm_siglevel_t siglevel;
- alpm_siglevel_t localfilesiglevel;
- alpm_siglevel_t remotefilesiglevel;
-
- alpm_siglevel_t siglevel_mask;
- alpm_siglevel_t localfilesiglevel_mask;
- alpm_siglevel_t remotefilesiglevel_mask;
+ /* Bitfield of alpm_transflag_t */
+ int flags;
+ /* Bitfields of alpm_siglevel_t */
+ int siglevel;
+ int localfilesiglevel;
+ int remotefilesiglevel;
+
+ int siglevel_mask;
+ int localfilesiglevel_mask;
+ int remotefilesiglevel_mask;
/* conf file options */
/* I Love Candy! */
diff --git a/src/pacman/package.c b/src/pacman/package.c
index 3ab9abc0..62ed7ce1 100644
--- a/src/pacman/package.c
+++ b/src/pacman/package.c
@@ -230,7 +230,7 @@ void dump_pkg_full(alpm_pkg_t *pkg, int extra)
break;
}
- alpm_pkgvalidation_t v = alpm_pkg_get_validation(pkg);
+ int v = alpm_pkg_get_validation(pkg);
if(v) {
if(v & ALPM_PKG_VALIDATION_NONE) {
validation = alpm_list_add(validation, _("None"));
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 8b306034..eeeb727a 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -630,7 +630,7 @@ static int process_target(const char *target, int error)
if(targname && targname != targstring) {
alpm_db_t *db;
const char *dbname;
- alpm_db_usage_t usage;
+ int usage;
*targname = '\0';
targname++;
diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c
index 591556d3..ab4a3b1e 100644
--- a/src/pacman/upgrade.c
+++ b/src/pacman/upgrade.c
@@ -89,15 +89,15 @@ int pacman_upgrade(alpm_list_t *targets)
for(i = targets, n = 0; i; i = alpm_list_next(i), n++) {
const char *targ = i->data;
alpm_pkg_t *pkg;
- alpm_siglevel_t level;
+ int siglevel;
if(file_is_remote[n]) {
- level = alpm_option_get_remote_file_siglevel(config->handle);
+ siglevel = alpm_option_get_remote_file_siglevel(config->handle);
} else {
- level = alpm_option_get_local_file_siglevel(config->handle);
+ siglevel = alpm_option_get_local_file_siglevel(config->handle);
}
- if(alpm_pkg_load(config->handle, targ, 1, level, &pkg) != 0) {
+ if(alpm_pkg_load(config->handle, targ, 1, siglevel, &pkg) != 0) {
pm_printf(ALPM_LOG_ERROR, "'%s': %s\n",
targ, alpm_strerror(alpm_errno(config->handle)));
retval = 1;
diff --git a/src/pacman/util.c b/src/pacman/util.c
index b9790836..fd7438b3 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -61,7 +61,7 @@ enum {
CELL_FREE = (1 << 3)
};
-int trans_init(alpm_transflag_t flags, int check_valid)
+int trans_init(int flags, int check_valid)
{
int ret;
diff --git a/src/pacman/util.h b/src/pacman/util.h
index 74ce4cb2..0a6ce978 100644
--- a/src/pacman/util.h
+++ b/src/pacman/util.h
@@ -45,7 +45,8 @@ typedef struct _pm_target_t {
} pm_target_t;
void trans_init_error(void);
-int trans_init(alpm_transflag_t flags, int check_valid);
+/* flags is a bitfield of alpm_transflag_t flags */
+int trans_init(int flags, int check_valid);
int trans_release(void);
int needs_root(void);
int check_syncdbs(size_t need_repos, int check_valid);
diff --git a/src/util/cleanupdelta.c b/src/util/cleanupdelta.c
index 043acf1a..bb178ce9 100644
--- a/src/util/cleanupdelta.c
+++ b/src/util/cleanupdelta.c
@@ -68,11 +68,11 @@ static void checkdbs(alpm_list_t *dbnames)
{
alpm_db_t *db = NULL;
alpm_list_t *i;
- const alpm_siglevel_t level = ALPM_SIG_DATABASE | ALPM_SIG_DATABASE_OPTIONAL;
+ const int siglevel = ALPM_SIG_DATABASE | ALPM_SIG_DATABASE_OPTIONAL;
for(i = dbnames; i; i = alpm_list_next(i)) {
const char *dbname = i->data;
- db = alpm_register_syncdb(handle, dbname, level);
+ db = alpm_register_syncdb(handle, dbname, siglevel);
if(db == NULL) {
fprintf(stderr, "error: could not register sync database '%s' (%s)\n",
dbname, alpm_strerror(alpm_errno(handle)));
diff --git a/src/util/testpkg.c b/src/util/testpkg.c
index 89e8dbd4..d5d90af8 100644
--- a/src/util/testpkg.c
+++ b/src/util/testpkg.c
@@ -43,7 +43,7 @@ int main(int argc, char *argv[])
alpm_handle_t *handle;
alpm_errno_t err;
alpm_pkg_t *pkg = NULL;
- const alpm_siglevel_t level = ALPM_SIG_PACKAGE | ALPM_SIG_PACKAGE_OPTIONAL;
+ const int siglevel = ALPM_SIG_PACKAGE | ALPM_SIG_PACKAGE_OPTIONAL;
if(argc != 2) {
fprintf(stderr, "testpkg (pacman) v" PACKAGE_VERSION "\n\n"
@@ -64,7 +64,7 @@ int main(int argc, char *argv[])
/* set gpgdir to default */
alpm_option_set_gpgdir(handle, GPGDIR);
- if(alpm_pkg_load(handle, argv[1], 1, level, &pkg) == -1
+ if(alpm_pkg_load(handle, argv[1], 1, siglevel, &pkg) == -1
|| pkg == NULL) {
err = alpm_errno(handle);
switch(err) {