summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsolsTiCe d'Hiver <solstice.dhiver@gmail.com>2009-09-26 19:30:32 +0200
committerDan McGee <dan@archlinux.org>2009-10-12 05:13:49 +0200
commite3ac8062626877b8cf87df5ce94f61394bf10c0f (patch)
treec0255292e9b657d00604be5f0a53bcd8f6f5936f
parentc7d8601e125de432f185c146c84333ca7d920d9a (diff)
downloadpacman-e3ac8062626877b8cf87df5ce94f61394bf10c0f.tar.gz
pacman-e3ac8062626877b8cf87df5ce94f61394bf10c0f.tar.xz
use bitwise shift operator in enum "bit field"
This offers a cleaner way to deal with constant in enum and allow easy maintainance Signed-off-by: solsTiCe d'Hiver <solstice.dhiver@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--lib/libalpm/alpm.h56
-rw-r--r--lib/libalpm/db.h12
2 files changed, 34 insertions, 34 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index ae2dc1fc..c433b73d 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -67,10 +67,10 @@ const char *alpm_version(void);
/* Levels */
typedef enum _pmloglevel_t {
- PM_LOG_ERROR = 0x01,
- PM_LOG_WARNING = 0x02,
- PM_LOG_DEBUG = 0x04,
- PM_LOG_FUNCTION = 0x08
+ PM_LOG_ERROR = 1,
+ PM_LOG_WARNING = (1 << 1),
+ PM_LOG_DEBUG = (1 << 2),
+ PM_LOG_FUNCTION = (1 << 3)
} pmloglevel_t;
typedef void (*alpm_cb_log)(pmloglevel_t, char *, va_list);
@@ -266,24 +266,24 @@ pmpkg_t *alpm_sync_newversion(pmpkg_t *pkg, alpm_list_t *dbs_sync);
/* Flags */
typedef enum _pmtransflag_t {
- PM_TRANS_FLAG_NODEPS = 0x01,
- PM_TRANS_FLAG_FORCE = 0x02,
- PM_TRANS_FLAG_NOSAVE = 0x04,
- /* 0x08 flag can go here */
- PM_TRANS_FLAG_CASCADE = 0x10,
- PM_TRANS_FLAG_RECURSE = 0x20,
- PM_TRANS_FLAG_DBONLY = 0x40,
- /* 0x80 flag can go here */
- PM_TRANS_FLAG_ALLDEPS = 0x100,
- PM_TRANS_FLAG_DOWNLOADONLY = 0x200,
- PM_TRANS_FLAG_NOSCRIPTLET = 0x400,
- PM_TRANS_FLAG_NOCONFLICTS = 0x800,
- /* 0x1000 flag can go here */
- PM_TRANS_FLAG_NEEDED = 0x2000,
- PM_TRANS_FLAG_ALLEXPLICIT = 0x4000,
- PM_TRANS_FLAG_UNNEEDED = 0x8000,
- PM_TRANS_FLAG_RECURSEALL = 0x10000,
- PM_TRANS_FLAG_NOLOCK = 0x20000
+ PM_TRANS_FLAG_NODEPS = 1,
+ PM_TRANS_FLAG_FORCE = (1 << 1),
+ PM_TRANS_FLAG_NOSAVE = (1 << 2),
+ /* (1 << 3) flag can go here */
+ PM_TRANS_FLAG_CASCADE = (1 << 4),
+ PM_TRANS_FLAG_RECURSE = (1 << 5),
+ PM_TRANS_FLAG_DBONLY = (1 << 6),
+ /* (1 << 7) flag can go here */
+ PM_TRANS_FLAG_ALLDEPS = (1 << 8),
+ PM_TRANS_FLAG_DOWNLOADONLY = (1 << 9),
+ PM_TRANS_FLAG_NOSCRIPTLET = (1 << 10),
+ PM_TRANS_FLAG_NOCONFLICTS = (1 << 11),
+ /* (1 << 12) flag can go here */
+ PM_TRANS_FLAG_NEEDED = (1 << 13),
+ PM_TRANS_FLAG_ALLEXPLICIT = (1 << 14),
+ PM_TRANS_FLAG_UNNEEDED = (1 << 15),
+ PM_TRANS_FLAG_RECURSEALL = (1 << 16),
+ PM_TRANS_FLAG_NOLOCK = (1 << 17)
} pmtransflag_t;
/**
@@ -370,12 +370,12 @@ typedef enum _pmtransevt_t {
/* Transaction Conversations (ie, questions) */
typedef enum _pmtransconv_t {
- PM_TRANS_CONV_INSTALL_IGNOREPKG = 0x01,
- PM_TRANS_CONV_REPLACE_PKG = 0x02,
- PM_TRANS_CONV_CONFLICT_PKG = 0x04,
- PM_TRANS_CONV_CORRUPTED_PKG = 0x08,
- PM_TRANS_CONV_LOCAL_NEWER = 0x10,
- PM_TRANS_CONV_REMOVE_PKGS = 0x20,
+ PM_TRANS_CONV_INSTALL_IGNOREPKG = 1,
+ PM_TRANS_CONV_REPLACE_PKG = (1 << 1),
+ PM_TRANS_CONV_CONFLICT_PKG = (1 << 2),
+ PM_TRANS_CONV_CORRUPTED_PKG = (1 << 3),
+ PM_TRANS_CONV_LOCAL_NEWER = (1 << 4),
+ PM_TRANS_CONV_REMOVE_PKGS = (1 << 5),
} pmtransconv_t;
/* Transaction Progress */
diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h
index e4e1dcb7..a540d02d 100644
--- a/lib/libalpm/db.h
+++ b/lib/libalpm/db.h
@@ -28,12 +28,12 @@
/* Database entries */
typedef enum _pmdbinfrq_t {
- INFRQ_BASE = 0x01,
- INFRQ_DESC = 0x02,
- INFRQ_DEPENDS = 0x04,
- INFRQ_FILES = 0x08,
- INFRQ_SCRIPTLET = 0x10,
- INFRQ_DELTAS = 0x20,
+ INFRQ_BASE = 1,
+ INFRQ_DESC = (1 << 1),
+ INFRQ_DEPENDS = (1 << 2),
+ INFRQ_FILES = (1 << 3),
+ INFRQ_SCRIPTLET = (1 << 4),
+ INFRQ_DELTAS = (1 << 5),
/* ALL should be sum of all above */
INFRQ_ALL = 0x3F
} pmdbinfrq_t;