mirror of
https://github.com/git-for-windows/git.git
synced 2026-04-09 06:51:56 -05:00
odb: use enum for odb_write_object flags
We've got a couple of functions that accept `odb_write_object()` flags, but all of them accept the flags as an `unsigned` integer. In fact, we don't even have an `enum` for the flags field. Introduce this `enum` and adapt functions accordingly according to our coding style. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
ff2e9d85d6
commit
b2d421ece6
@@ -1169,7 +1169,8 @@ cleanup:
|
||||
int odb_source_loose_write_object(struct odb_source *source,
|
||||
const void *buf, unsigned long len,
|
||||
enum object_type type, struct object_id *oid,
|
||||
struct object_id *compat_oid_in, unsigned flags)
|
||||
struct object_id *compat_oid_in,
|
||||
enum odb_write_object_flags flags)
|
||||
{
|
||||
const struct git_hash_algo *algo = source->odb->repo->hash_algo;
|
||||
const struct git_hash_algo *compat = source->odb->repo->compat_hash_algo;
|
||||
|
||||
@@ -68,7 +68,8 @@ int odb_source_loose_freshen_object(struct odb_source *source,
|
||||
int odb_source_loose_write_object(struct odb_source *source,
|
||||
const void *buf, unsigned long len,
|
||||
enum object_type type, struct object_id *oid,
|
||||
struct object_id *compat_oid_in, unsigned flags);
|
||||
struct object_id *compat_oid_in,
|
||||
enum odb_write_object_flags flags);
|
||||
|
||||
int odb_source_loose_write_stream(struct odb_source *source,
|
||||
struct odb_write_stream *stream, size_t len,
|
||||
|
||||
2
odb.c
2
odb.c
@@ -1053,7 +1053,7 @@ int odb_write_object_ext(struct object_database *odb,
|
||||
enum object_type type,
|
||||
struct object_id *oid,
|
||||
struct object_id *compat_oid,
|
||||
unsigned flags)
|
||||
enum odb_write_object_flags flags)
|
||||
{
|
||||
return odb_source_write_object(odb->sources, buf, len, type,
|
||||
oid, compat_oid, flags);
|
||||
|
||||
4
odb.h
4
odb.h
@@ -561,7 +561,7 @@ int odb_find_abbrev_len(struct object_database *odb,
|
||||
int min_len,
|
||||
unsigned *out);
|
||||
|
||||
enum {
|
||||
enum odb_write_object_flags {
|
||||
/*
|
||||
* By default, `odb_write_object()` does not actually write anything
|
||||
* into the object store, but only computes the object ID. This flag
|
||||
@@ -589,7 +589,7 @@ int odb_write_object_ext(struct object_database *odb,
|
||||
enum object_type type,
|
||||
struct object_id *oid,
|
||||
struct object_id *compat_oid,
|
||||
unsigned flags);
|
||||
enum odb_write_object_flags flags);
|
||||
|
||||
static inline int odb_write_object(struct object_database *odb,
|
||||
const void *buf, unsigned long len,
|
||||
|
||||
@@ -161,7 +161,7 @@ static int odb_source_files_write_object(struct odb_source *source,
|
||||
enum object_type type,
|
||||
struct object_id *oid,
|
||||
struct object_id *compat_oid,
|
||||
unsigned flags)
|
||||
enum odb_write_object_flags flags)
|
||||
{
|
||||
return odb_source_loose_write_object(source, buf, len, type,
|
||||
oid, compat_oid, flags);
|
||||
|
||||
@@ -197,7 +197,7 @@ struct odb_source {
|
||||
enum object_type type,
|
||||
struct object_id *oid,
|
||||
struct object_id *compat_oid,
|
||||
unsigned flags);
|
||||
enum odb_write_object_flags flags);
|
||||
|
||||
/*
|
||||
* This callback is expected to persist the given object stream into
|
||||
@@ -405,7 +405,7 @@ static inline int odb_source_write_object(struct odb_source *source,
|
||||
enum object_type type,
|
||||
struct object_id *oid,
|
||||
struct object_id *compat_oid,
|
||||
unsigned flags)
|
||||
enum odb_write_object_flags flags)
|
||||
{
|
||||
return source->write_object(source, buf, len, type, oid,
|
||||
compat_oid, flags);
|
||||
|
||||
Reference in New Issue
Block a user