Commit 33c5c513 by Edward Thomson

filebuf: use GIT_ASSERT

parent a08bd547
...@@ -184,7 +184,7 @@ static int write_deflate(git_filebuf *file, void *source, size_t len) ...@@ -184,7 +184,7 @@ static int write_deflate(git_filebuf *file, void *source, size_t len)
} while (zs->avail_out == 0); } while (zs->avail_out == 0);
assert(zs->avail_in == 0); GIT_ASSERT(zs->avail_in == 0);
if (file->compute_digest) if (file->compute_digest)
git_hash_update(&file->digest, source, len); git_hash_update(&file->digest, source, len);
...@@ -278,10 +278,9 @@ int git_filebuf_open_withsize(git_filebuf *file, const char *path, int flags, mo ...@@ -278,10 +278,9 @@ int git_filebuf_open_withsize(git_filebuf *file, const char *path, int flags, mo
int compression, error = -1; int compression, error = -1;
size_t path_len, alloc_len; size_t path_len, alloc_len;
/* opening an already open buffer is a programming error; GIT_ASSERT_ARG(file);
* assert that this never happens instead of returning GIT_ASSERT_ARG(path);
* an error code */ GIT_ASSERT(file->buffer == NULL);
assert(file && path && file->buffer == NULL);
memset(file, 0x0, sizeof(git_filebuf)); memset(file, 0x0, sizeof(git_filebuf));
...@@ -389,7 +388,9 @@ cleanup: ...@@ -389,7 +388,9 @@ cleanup:
int git_filebuf_hash(git_oid *oid, git_filebuf *file) int git_filebuf_hash(git_oid *oid, git_filebuf *file)
{ {
assert(oid && file && file->compute_digest); GIT_ASSERT_ARG(oid);
GIT_ASSERT_ARG(file);
GIT_ASSERT_ARG(file->compute_digest);
flush_buffer(file); flush_buffer(file);
...@@ -415,7 +416,8 @@ int git_filebuf_commit_at(git_filebuf *file, const char *path) ...@@ -415,7 +416,8 @@ int git_filebuf_commit_at(git_filebuf *file, const char *path)
int git_filebuf_commit(git_filebuf *file) int git_filebuf_commit(git_filebuf *file)
{ {
/* temporary files cannot be committed */ /* temporary files cannot be committed */
assert(file && file->path_original); GIT_ASSERT_ARG(file);
GIT_ASSERT(file->path_original);
file->flush_mode = Z_FINISH; file->flush_mode = Z_FINISH;
flush_buffer(file); flush_buffer(file);
......
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