From c7ad73d0a95ed527e1efe013b97cf849f3af55e9 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Mon, 2 Jun 2014 00:32:45 +0200 Subject: Move enum definitions out of structs This untangles the types, and makes it possible to use functions that use such enums as arguments from C++ code, as otherwise the enum would need to be declared within the struct namespace. --- src/filesdb.h | 42 ++++++++++++++++++++++-------------------- src/main.h | 24 ++++++++++++++++-------- 2 files changed, 38 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/filesdb.h b/src/filesdb.h index 80f102ec5..051910a06 100644 --- a/src/filesdb.h +++ b/src/filesdb.h @@ -56,6 +56,27 @@ enum fnnflags { fnn_nonew = DPKG_BIT(1), }; +enum filenamenode_flags { + /** In the newconffiles list. */ + fnnf_new_conff = DPKG_BIT(0), + /** In the new filesystem archive. */ + fnnf_new_inarchive = DPKG_BIT(1), + /** In the old package's conffiles list. */ + fnnf_old_conff = DPKG_BIT(2), + /** Obsolete conffile. */ + fnnf_obs_conff = DPKG_BIT(3), + /** Must remove from other packages' lists. */ + fnnf_elide_other_lists = DPKG_BIT(4), + /** >= 1 instance is a dir, cannot rename over. */ + fnnf_no_atomic_overwrite = DPKG_BIT(5), + /** New file has been placed on the disk. */ + fnnf_placed_on_disk = DPKG_BIT(6), + fnnf_deferred_fsync = DPKG_BIT(7), + fnnf_deferred_rename = DPKG_BIT(8), + /** Path being filtered. */ + fnnf_filtered = DPKG_BIT(9), +}; + struct filenamenode { struct filenamenode *next; const char *name; @@ -75,26 +96,7 @@ struct filenamenode { */ /** Set to zero when a new node is created. */ - enum filenamenode_flags { - /** In the newconffiles list. */ - fnnf_new_conff = DPKG_BIT(0), - /** In the new filesystem archive. */ - fnnf_new_inarchive = DPKG_BIT(1), - /** In the old package's conffiles list. */ - fnnf_old_conff = DPKG_BIT(2), - /** Obsolete conffile. */ - fnnf_obs_conff = DPKG_BIT(3), - /** Must remove from other packages' lists. */ - fnnf_elide_other_lists = DPKG_BIT(4), - /** >= 1 instance is a dir, cannot rename over. */ - fnnf_no_atomic_overwrite = DPKG_BIT(5), - /** New file has been placed on the disk. */ - fnnf_placed_on_disk = DPKG_BIT(6), - fnnf_deferred_fsync = DPKG_BIT(7), - fnnf_deferred_rename = DPKG_BIT(8), - /** Path being filtered. */ - fnnf_filtered = DPKG_BIT(9), - } flags; + enum filenamenode_flags flags; /** Valid iff this namenode is in the newconffiles list. */ const char *oldhash; diff --git a/src/main.h b/src/main.h index 53f16f529..735af9e55 100644 --- a/src/main.h +++ b/src/main.h @@ -29,17 +29,25 @@ struct fileinlist; struct filenamenode; +enum istobes { + itb_normal, + itb_remove, + itb_installnew, + itb_deconfigure, + itb_preinstall +}; + +enum pkg_cycle_color { + white, + gray, + black, +}; + struct perpackagestate { - enum istobes { - itb_normal, itb_remove, itb_installnew, itb_deconfigure, itb_preinstall - } istobe; + enum istobe istobe; /** Used during cycle detection. */ - enum pkg_cycle_color { - white, - gray, - black, - } color; + enum pkg_cycle_color color; /** * filelistvalid files Meaning -- cgit v1.2.3