From 1b61cc8c69025ddd394401a506b21f16df5d4e6d Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Wed, 24 Jan 2007 03:02:53 +0000 Subject: This mainly deals with code clarity- removing currently unneeded optimizations in order to make the code much more readable and type-checkable. Every enum in the library now has it's own type that should be used instead of the generic 'unsigned char'. In addition, several #define statements dealing with constants were converted to enums. Signed-off-by: Dan McGee --- lib/libalpm/trans.h | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'lib/libalpm/trans.h') diff --git a/lib/libalpm/trans.h b/lib/libalpm/trans.h index 2fcec2ed..8d5c6362 100644 --- a/lib/libalpm/trans.h +++ b/lib/libalpm/trans.h @@ -26,11 +26,21 @@ #include "alpm.h" +typedef enum _pmtransstate_t { + STATE_IDLE = 0, + STATE_INITIALIZED, + STATE_PREPARED, + STATE_DOWNLOADING, + STATE_COMMITING, + STATE_COMMITED, + STATE_INTERRUPTED +} pmtransstate_t; + /* Transaction */ struct __pmtrans_t { - unsigned char type; + pmtranstype_t type; unsigned int flags; - unsigned char state; + pmtransstate_t state; alpm_list_t *targets; /* alpm_list_t of (char *) */ alpm_list_t *packages; /* alpm_list_t of (pmpkg_t *) or (pmsyncpkg_t *) */ alpm_list_t *skiplist; /* alpm_list_t of (char *) */ @@ -39,16 +49,6 @@ struct __pmtrans_t { alpm_trans_cb_progress cb_progress; }; -enum { - STATE_IDLE = 0, - STATE_INITIALIZED, - STATE_PREPARED, - STATE_DOWNLOADING, - STATE_COMMITING, - STATE_COMMITED, - STATE_INTERRUPTED -}; - #define FREETRANS(p) \ do { \ if(p) { \ @@ -77,7 +77,9 @@ do { \ pmtrans_t *_alpm_trans_new(void); void _alpm_trans_free(void *data); -int _alpm_trans_init(pmtrans_t *trans, unsigned char type, unsigned int flags, alpm_trans_cb_event event, alpm_trans_cb_conv conv, alpm_trans_cb_progress progress); +int _alpm_trans_init(pmtrans_t *trans, pmtranstype_t type, unsigned int flags, + alpm_trans_cb_event event, alpm_trans_cb_conv conv, + alpm_trans_cb_progress progress); int _alpm_trans_sysupgrade(pmtrans_t *trans); int _alpm_trans_addtarget(pmtrans_t *trans, char *target); int _alpm_trans_prepare(pmtrans_t *trans, alpm_list_t **data); -- cgit v1.2.3-24-g4f1b