1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-23 00:08:50 -05:00

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>
This commit is contained in:
solsTiCe d'Hiver 2009-09-26 19:30:32 +02:00 committed by Dan McGee
parent c7d8601e12
commit e3ac806262
2 changed files with 34 additions and 34 deletions

View File

@ -67,10 +67,10 @@ const char *alpm_version(void);
/* Levels */ /* Levels */
typedef enum _pmloglevel_t { typedef enum _pmloglevel_t {
PM_LOG_ERROR = 0x01, PM_LOG_ERROR = 1,
PM_LOG_WARNING = 0x02, PM_LOG_WARNING = (1 << 1),
PM_LOG_DEBUG = 0x04, PM_LOG_DEBUG = (1 << 2),
PM_LOG_FUNCTION = 0x08 PM_LOG_FUNCTION = (1 << 3)
} pmloglevel_t; } pmloglevel_t;
typedef void (*alpm_cb_log)(pmloglevel_t, char *, va_list); 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 */ /* Flags */
typedef enum _pmtransflag_t { typedef enum _pmtransflag_t {
PM_TRANS_FLAG_NODEPS = 0x01, PM_TRANS_FLAG_NODEPS = 1,
PM_TRANS_FLAG_FORCE = 0x02, PM_TRANS_FLAG_FORCE = (1 << 1),
PM_TRANS_FLAG_NOSAVE = 0x04, PM_TRANS_FLAG_NOSAVE = (1 << 2),
/* 0x08 flag can go here */ /* (1 << 3) flag can go here */
PM_TRANS_FLAG_CASCADE = 0x10, PM_TRANS_FLAG_CASCADE = (1 << 4),
PM_TRANS_FLAG_RECURSE = 0x20, PM_TRANS_FLAG_RECURSE = (1 << 5),
PM_TRANS_FLAG_DBONLY = 0x40, PM_TRANS_FLAG_DBONLY = (1 << 6),
/* 0x80 flag can go here */ /* (1 << 7) flag can go here */
PM_TRANS_FLAG_ALLDEPS = 0x100, PM_TRANS_FLAG_ALLDEPS = (1 << 8),
PM_TRANS_FLAG_DOWNLOADONLY = 0x200, PM_TRANS_FLAG_DOWNLOADONLY = (1 << 9),
PM_TRANS_FLAG_NOSCRIPTLET = 0x400, PM_TRANS_FLAG_NOSCRIPTLET = (1 << 10),
PM_TRANS_FLAG_NOCONFLICTS = 0x800, PM_TRANS_FLAG_NOCONFLICTS = (1 << 11),
/* 0x1000 flag can go here */ /* (1 << 12) flag can go here */
PM_TRANS_FLAG_NEEDED = 0x2000, PM_TRANS_FLAG_NEEDED = (1 << 13),
PM_TRANS_FLAG_ALLEXPLICIT = 0x4000, PM_TRANS_FLAG_ALLEXPLICIT = (1 << 14),
PM_TRANS_FLAG_UNNEEDED = 0x8000, PM_TRANS_FLAG_UNNEEDED = (1 << 15),
PM_TRANS_FLAG_RECURSEALL = 0x10000, PM_TRANS_FLAG_RECURSEALL = (1 << 16),
PM_TRANS_FLAG_NOLOCK = 0x20000 PM_TRANS_FLAG_NOLOCK = (1 << 17)
} pmtransflag_t; } pmtransflag_t;
/** /**
@ -370,12 +370,12 @@ typedef enum _pmtransevt_t {
/* Transaction Conversations (ie, questions) */ /* Transaction Conversations (ie, questions) */
typedef enum _pmtransconv_t { typedef enum _pmtransconv_t {
PM_TRANS_CONV_INSTALL_IGNOREPKG = 0x01, PM_TRANS_CONV_INSTALL_IGNOREPKG = 1,
PM_TRANS_CONV_REPLACE_PKG = 0x02, PM_TRANS_CONV_REPLACE_PKG = (1 << 1),
PM_TRANS_CONV_CONFLICT_PKG = 0x04, PM_TRANS_CONV_CONFLICT_PKG = (1 << 2),
PM_TRANS_CONV_CORRUPTED_PKG = 0x08, PM_TRANS_CONV_CORRUPTED_PKG = (1 << 3),
PM_TRANS_CONV_LOCAL_NEWER = 0x10, PM_TRANS_CONV_LOCAL_NEWER = (1 << 4),
PM_TRANS_CONV_REMOVE_PKGS = 0x20, PM_TRANS_CONV_REMOVE_PKGS = (1 << 5),
} pmtransconv_t; } pmtransconv_t;
/* Transaction Progress */ /* Transaction Progress */

View File

@ -28,12 +28,12 @@
/* Database entries */ /* Database entries */
typedef enum _pmdbinfrq_t { typedef enum _pmdbinfrq_t {
INFRQ_BASE = 0x01, INFRQ_BASE = 1,
INFRQ_DESC = 0x02, INFRQ_DESC = (1 << 1),
INFRQ_DEPENDS = 0x04, INFRQ_DEPENDS = (1 << 2),
INFRQ_FILES = 0x08, INFRQ_FILES = (1 << 3),
INFRQ_SCRIPTLET = 0x10, INFRQ_SCRIPTLET = (1 << 4),
INFRQ_DELTAS = 0x20, INFRQ_DELTAS = (1 << 5),
/* ALL should be sum of all above */ /* ALL should be sum of all above */
INFRQ_ALL = 0x3F INFRQ_ALL = 0x3F
} pmdbinfrq_t; } pmdbinfrq_t;