diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2013-08-15 13:48:35 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2013-08-15 14:29:27 +0200 |
commit | 376e6c9f96ffcd572ba974c9cc4d13b4f1e31474 (patch) | |
tree | 8f8cfb27e725e962e3c7cec5e7fa2c4bfa2987bd /src/odb.c | |
parent | 2af9bcb2dbb47adafa7eecbf41ff113da7fa9d1b (diff) | |
download | libgit2-376e6c9f96ffcd572ba974c9cc4d13b4f1e31474.tar.gz |
odb: wrap the stream reading and writing functions
This is in preparation for moving the hashing to the frontend, which
requires us to handle the incoming data before passing it to the
backend's stream.
Diffstat (limited to 'src/odb.c')
-rw-r--r-- | src/odb.c | 26 |
1 files changed, 23 insertions, 3 deletions
@@ -864,9 +864,9 @@ int git_odb_write( if ((error = git_odb_open_wstream(&stream, db, len, type)) != 0) return error; - stream->write(stream, data, len); - error = stream->finalize_write(oid, stream); - stream->free(stream); + git_odb_stream_write(stream, data, len); + error = git_odb_stream_finalize_write(oid, stream); + git_odb_stream_free(stream); return error; } @@ -904,6 +904,26 @@ int git_odb_open_wstream( return error; } +int git_odb_stream_write(git_odb_stream *stream, const char *buffer, size_t len) +{ + return stream->write(stream, buffer, len); +} + +int git_odb_stream_finalize_write(git_oid *out, git_odb_stream *stream) +{ + return stream->finalize_write(out, stream); +} + +int git_odb_stream_read(git_odb_stream *stream, char *buffer, size_t len) +{ + return stream->read(stream, buffer, len); +} + +void git_odb_stream_free(git_odb_stream *stream) +{ + stream->free(stream); +} + int git_odb_open_rstream(git_odb_stream **stream, git_odb *db, const git_oid *oid) { size_t i, reads = 0; |