git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/6] treewide: use enum for `odb_for_each_object()` flags

From
Patrick Steinhardt <ps@pks.im>
Date
Mar 31, 2026, 23:57 UTC
Message-ID
<20260401-pks-odb-cleanups-v1-2-89adba9ada68@pks.im>
In-Reply-To
<20260401-pks-odb-cleanups-v1-0-89adba9ada68@pks.im>

We've got a couple of callsites where we pass `odb_for_each_object()` flags, but accept an `unsigned` flags field instead of the corresponding enum. Adapt these to accept the enum type instead.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 odb.c      | 2 +-
 odb.h      | 2 +-
 packfile.c | 2 +-
 packfile.h | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/odb.c b/odb.c
index 3f94a53df1..9a11c60048 100644
--- a/odb.c
+++ b/odb.c
@@ -922,7 +922,7 @@ int odb_for_each_object(struct object_database *odb,
 			const struct object_info *request,
 			odb_for_each_object_cb cb,
 			void *cb_data,
-			unsigned flags)
+			enum odb_for_each_object_flags flags)
 {
 	struct odb_for_each_object_options opts = {
 		.flags = flags,
diff --git a/odb.h b/odb.h
index 984bafca9d..09affaf6a5 100644
--- a/odb.h
+++ b/odb.h
@@ -522,7 +522,7 @@ int odb_for_each_object(struct object_database *odb,
 			const struct object_info *request,
 			odb_for_each_object_cb cb,
 			void *cb_data,
-			unsigned flags);
+			enum odb_for_each_object_flags flags);
 
 enum odb_count_objects_flags {
 	/*
diff --git a/packfile.c b/packfile.c
index ee9c7ea1d1..5d3b772973 100644
--- a/packfile.c
+++ b/packfile.c
@@ -2299,7 +2299,7 @@ int has_object_kept_pack(struct repository *r, const struct object_id *oid,
 
 int for_each_object_in_pack(struct packed_git *p,
 			    each_packed_object_fn cb, void *data,
-			    unsigned flags)
+			    enum odb_for_each_object_flags flags)
 {
 	uint32_t i;
 	int r = 0;
diff --git a/packfile.h b/packfile.h
index 45b35973f0..3eb10d6b65 100644
--- a/packfile.h
+++ b/packfile.h
@@ -352,7 +352,7 @@ typedef int each_packed_object_fn(const struct object_id *oid,
 				  void *data);
 int for_each_object_in_pack(struct packed_git *p,
 			    each_packed_object_fn, void *data,
-			    unsigned flags);
+			    enum odb_for_each_object_flags flags);
 
 /*
  * Iterate through all packed objects in the given packfile store and invoke
-- 
2.53.0.1185.g05d4b7b318.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 3 of 7 in “odb: small set of cleanups”
  1. 0/6 odb: small set of cleanupsPatrick Steinhardt, Mar 31, 2026
  2. 1/6 CodingGuidelines: document our style for flagsPatrick Steinhardt, Mar 31, 2026
  3. 2/6 treewide: use enum for `odb_for_each_object()` flagsPatrick Steinhardt, Mar 31, 2026
  4. 3/6 odb: rename `odb_write_object()` flagsPatrick Steinhardt, Mar 31, 2026
  5. 4/6 odb: use enum for `odb_write_object` flagsPatrick Steinhardt, Mar 31, 2026
  6. 5/6 odb: rename `odb_has_object()` flagsPatrick Steinhardt, Mar 31, 2026
  7. 6/6 odb: drop unneeded headers and forward declsPatrick Steinhardt, Mar 31, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.