mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-03 02:40:09 +00:00
Make git_odb_foreach_cb take const param
This makes the first OID param of the ODB callback a const pointer and also propogates that change all the way to the backends.
This commit is contained in:
parent
f984d97b22
commit
c3fb7d04ed
@ -22,11 +22,6 @@
|
|||||||
*/
|
*/
|
||||||
GIT_BEGIN_DECL
|
GIT_BEGIN_DECL
|
||||||
|
|
||||||
/**
|
|
||||||
* Function type for callbacks from git_odb_foreach.
|
|
||||||
*/
|
|
||||||
typedef int (*git_odb_foreach_cb)(git_oid *id, void *payload);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new object database with no backends.
|
* Create a new object database with no backends.
|
||||||
*
|
*
|
||||||
|
@ -24,7 +24,14 @@ GIT_BEGIN_DECL
|
|||||||
struct git_odb_stream;
|
struct git_odb_stream;
|
||||||
struct git_odb_writepack;
|
struct git_odb_writepack;
|
||||||
|
|
||||||
/** An instance for a custom backend */
|
/**
|
||||||
|
* Function type for callbacks from git_odb_foreach.
|
||||||
|
*/
|
||||||
|
typedef int (*git_odb_foreach_cb)(const git_oid *id, void *payload);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An instance for a custom backend
|
||||||
|
*/
|
||||||
struct git_odb_backend {
|
struct git_odb_backend {
|
||||||
git_odb *odb;
|
git_odb *odb;
|
||||||
|
|
||||||
@ -79,7 +86,7 @@ struct git_odb_backend {
|
|||||||
|
|
||||||
int (* foreach)(
|
int (* foreach)(
|
||||||
struct git_odb_backend *,
|
struct git_odb_backend *,
|
||||||
int (*cb)(git_oid *oid, void *payload),
|
git_odb_foreach_cb cb,
|
||||||
void *payload);
|
void *payload);
|
||||||
|
|
||||||
int (* writepack)(
|
int (* writepack)(
|
||||||
|
@ -678,7 +678,7 @@ static int loose_backend__exists(git_odb_backend *backend, const git_oid *oid)
|
|||||||
|
|
||||||
struct foreach_state {
|
struct foreach_state {
|
||||||
size_t dir_len;
|
size_t dir_len;
|
||||||
int (*cb)(git_oid *oid, void *data);
|
git_odb_foreach_cb cb;
|
||||||
void *data;
|
void *data;
|
||||||
int cb_error;
|
int cb_error;
|
||||||
};
|
};
|
||||||
@ -734,7 +734,7 @@ static int foreach_cb(void *_state, git_buf *path)
|
|||||||
return git_path_direach(path, foreach_object_dir_cb, state);
|
return git_path_direach(path, foreach_object_dir_cb, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int loose_backend__foreach(git_odb_backend *_backend, int (*cb)(git_oid *oid, void *data), void *data)
|
static int loose_backend__foreach(git_odb_backend *_backend, git_odb_foreach_cb cb, void *data)
|
||||||
{
|
{
|
||||||
char *objects_dir;
|
char *objects_dir;
|
||||||
int error;
|
int error;
|
||||||
|
@ -458,7 +458,7 @@ static int pack_backend__exists(git_odb_backend *backend, const git_oid *oid)
|
|||||||
return pack_entry_find(&e, (struct pack_backend *)backend, oid) == 0;
|
return pack_entry_find(&e, (struct pack_backend *)backend, oid) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pack_backend__foreach(git_odb_backend *_backend, int (*cb)(git_oid *oid, void *data), void *data)
|
static int pack_backend__foreach(git_odb_backend *_backend, git_odb_foreach_cb cb, void *data)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
struct git_pack_file *p;
|
struct git_pack_file *p;
|
||||||
|
@ -698,7 +698,7 @@ static int git__memcmp4(const void *a, const void *b) {
|
|||||||
|
|
||||||
int git_pack_foreach_entry(
|
int git_pack_foreach_entry(
|
||||||
struct git_pack_file *p,
|
struct git_pack_file *p,
|
||||||
int (*cb)(git_oid *oid, void *data),
|
git_odb_foreach_cb cb,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
const unsigned char *index = p->index_map.data, *current;
|
const unsigned char *index = p->index_map.data, *current;
|
||||||
|
@ -105,7 +105,7 @@ int git_pack_entry_find(
|
|||||||
size_t len);
|
size_t len);
|
||||||
int git_pack_foreach_entry(
|
int git_pack_foreach_entry(
|
||||||
struct git_pack_file *p,
|
struct git_pack_file *p,
|
||||||
int (*cb)(git_oid *oid, void *data),
|
git_odb_foreach_cb cb,
|
||||||
void *data);
|
void *data);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,7 +16,7 @@ void test_odb_foreach__cleanup(void)
|
|||||||
_repo = NULL;
|
_repo = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int foreach_cb(git_oid *oid, void *data)
|
static int foreach_cb(const git_oid *oid, void *data)
|
||||||
{
|
{
|
||||||
GIT_UNUSED(data);
|
GIT_UNUSED(data);
|
||||||
GIT_UNUSED(oid);
|
GIT_UNUSED(oid);
|
||||||
@ -59,7 +59,7 @@ void test_odb_foreach__one_pack(void)
|
|||||||
cl_assert(nobj == 1628);
|
cl_assert(nobj == 1628);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int foreach_stop_cb(git_oid *oid, void *data)
|
static int foreach_stop_cb(const git_oid *oid, void *data)
|
||||||
{
|
{
|
||||||
GIT_UNUSED(data);
|
GIT_UNUSED(data);
|
||||||
GIT_UNUSED(oid);
|
GIT_UNUSED(oid);
|
||||||
|
Loading…
Reference in New Issue
Block a user