diff mbox series

[3/9] archiver API: make the "flags" in "struct archiver" an enum

Message ID patch-3.9-9d1a68b5282-20230202T093212Z-avarab@gmail.com (mailing list archive)
State New, archived
Headers show
Series git archive: use gzip again by default, document output stabilty | expand

Commit Message

Ævar Arnfjörð Bjarmason Feb. 2, 2023, 9:32 a.m. UTC
Refactor the "#define" pattern in the archiver.h to use a new "enum
archiver_flags". This isn't a functional change, but will make adding
new flags in a subsequent commit easier to reason about.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 archive.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/archive.h b/archive.h
index 08bed3ed3af..6b51288c2ed 100644
--- a/archive.h
+++ b/archive.h
@@ -36,13 +36,15 @@  const char *archive_format_from_filename(const char *filename);
 
 /* archive backend stuff */
 
-#define ARCHIVER_WANT_COMPRESSION_LEVELS 1
-#define ARCHIVER_REMOTE 2
-#define ARCHIVER_HIGH_COMPRESSION_LEVELS 4
+enum archiver_flags {
+	ARCHIVER_WANT_COMPRESSION_LEVELS = 1<<0,
+	ARCHIVER_REMOTE = 1<<1,
+	ARCHIVER_HIGH_COMPRESSION_LEVELS = 1<<2,
+};
 struct archiver {
 	const char *name;
 	int (*write_archive)(const struct archiver *, struct archiver_args *);
-	unsigned flags;
+	enum archiver_flags flags;
 	char *filter_command;
 };
 void register_archiver(struct archiver *);