Commit c8ee5270 by Patrick Steinhardt

pack: rename `git_packfile_stream_free`

The function `git_packfile_stream_free` frees all state of the packfile
stream without freeing the structure itself. This naming makes it hard
to spot whether it will try to free the pointer itself or not, causing
potential future errors. Due to this reason, we have decided to name a
function freeing state without freeing the actual struture a "dispose"
function.

Rename `git_packfile_stream_free` to `git_packfile_stream_dispose` as a
first example following this rule.
parent 422cd59b
......@@ -650,7 +650,7 @@ int git_indexer_append(git_indexer *idx, const void *data, size_t size, git_tran
/* We want to free the stream reasorces no matter what here */
idx->have_stream = 0;
git_packfile_stream_free(stream);
git_packfile_stream_dispose(stream);
if (error < 0)
goto on_error;
......@@ -1137,7 +1137,7 @@ void git_indexer_free(git_indexer *idx)
return;
if (idx->have_stream)
git_packfile_stream_free(&idx->stream);
git_packfile_stream_dispose(&idx->stream);
git_vector_free_deep(&idx->objects);
......
......@@ -499,7 +499,7 @@ int git_packfile_resolve_header(
if ((error = git_packfile_stream_open(&stream, p, curpos)) < 0)
return error;
error = git_delta_read_header_fromstream(&base_size, size_p, &stream);
git_packfile_stream_free(&stream);
git_packfile_stream_dispose(&stream);
if (error < 0)
return error;
} else {
......@@ -840,7 +840,7 @@ ssize_t git_packfile_stream_read(git_packfile_stream *obj, void *buffer, size_t
}
void git_packfile_stream_free(git_packfile_stream *obj)
void git_packfile_stream_dispose(git_packfile_stream *obj)
{
inflateEnd(&obj->zstream);
}
......
......@@ -144,7 +144,7 @@ int git_packfile_unpack(git_rawobj *obj, struct git_pack_file *p, git_off_t *obj
int git_packfile_stream_open(git_packfile_stream *obj, struct git_pack_file *p, git_off_t curpos);
ssize_t git_packfile_stream_read(git_packfile_stream *obj, void *buffer, size_t len);
void git_packfile_stream_free(git_packfile_stream *obj);
void git_packfile_stream_dispose(git_packfile_stream *obj);
git_off_t get_delta_base(struct git_pack_file *p, git_mwindow **w_curs,
git_off_t *curpos, git_otype type,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment