Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/odb.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-08-17 03:41:08 +0400
committerCarlos Martín Nieto <cmn@dwim.me>2013-08-17 03:41:08 +0400
commitfe0c6d4e712fa1bb072b8a847783bad47f3e91eb (patch)
treea6d2aa207b418038028ccd5d806c74dc65b34646 /src/odb.c
parentd4e6cf0cd05540b373bfcb8908e4bc8f8f72c73c (diff)
odb: make it clearer that the id is calculated in the frontend
The frontend is in charge of calculating the id of the objects. Thus the backends should treat it as a read-only value. The positioning in the function signature made it seem as though it was an output parameter. Make the id const and move it from the front to behind the subject (backend or stream).
Diffstat (limited to 'src/odb.c')
-rw-r--r--src/odb.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/odb.c b/src/odb.c
index b7f64dfc9..d2be60f97 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -291,10 +291,10 @@ typedef struct {
git_otype type;
} fake_wstream;
-static int fake_wstream__fwrite(git_oid *oid, git_odb_stream *_stream)
+static int fake_wstream__fwrite(git_odb_stream *_stream, const git_oid *oid)
{
fake_wstream *stream = (fake_wstream *)_stream;
- return _stream->backend->write(oid, _stream->backend, stream->buffer, stream->size, stream->type);
+ return _stream->backend->write(_stream->backend, oid, stream->buffer, stream->size, stream->type);
}
static int fake_wstream__write(git_odb_stream *_stream, const char *data, size_t len)
@@ -851,7 +851,7 @@ int git_odb_write(
continue;
if (b->write != NULL)
- error = b->write(oid, b, data, len, type);
+ error = b->write(b, oid, data, len, type);
}
if (!error || error == GIT_PASSTHROUGH)
@@ -931,7 +931,7 @@ int git_odb_stream_write(git_odb_stream *stream, const char *buffer, size_t len)
int git_odb_stream_finalize_write(git_oid *out, git_odb_stream *stream)
{
git_hash_final(out, stream->hash_ctx);
- return stream->finalize_write(out, stream);
+ return stream->finalize_write(stream, out);
}
int git_odb_stream_read(git_odb_stream *stream, char *buffer, size_t len)