summaryrefslogtreecommitdiff
path: root/src/revparse.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2020-04-05 21:57:22 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2020-11-27 11:09:21 +0000
commit5bd139e922e32e83403a23d575731b39a7e8ebf4 (patch)
treeea3554efb0bedb6f4856489f58696043c981cba1 /src/revparse.c
parent055fbf6d904a7799cb42293da588082b6dca84a4 (diff)
downloadlibgit2-5bd139e922e32e83403a23d575731b39a7e8ebf4.tar.gz
revparse: use GIT_ASSERT
Diffstat (limited to 'src/revparse.c')
-rw-r--r--src/revparse.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/revparse.c b/src/revparse.c
index 1cc8b97f5..4b919d32a 100644
--- a/src/revparse.c
+++ b/src/revparse.c
@@ -317,7 +317,7 @@ static int handle_at_syntax(git_object **out, git_reference **ref, const char *s
git_buf identifier = GIT_BUF_INIT;
git_time_t timestamp;
- assert(*out == NULL);
+ GIT_ASSERT(*out == NULL);
if (git_buf_put(&identifier, spec, identifier_len) < 0)
return -1;
@@ -524,7 +524,7 @@ static int extract_curly_braces_content(git_buf *buf, const char *spec, size_t *
{
git_buf_clear(buf);
- assert(spec[*pos] == '^' || spec[*pos] == '@');
+ GIT_ASSERT_ARG(spec[*pos] == '^' || spec[*pos] == '@');
(*pos)++;
@@ -550,7 +550,7 @@ static int extract_path(git_buf *buf, const char *spec, size_t *pos)
{
git_buf_clear(buf);
- assert(spec[*pos] == ':');
+ GIT_ASSERT_ARG(spec[*pos] == ':');
(*pos)++;
@@ -568,7 +568,7 @@ static int extract_how_many(int *n, const char *spec, size_t *pos)
int parsed, accumulated;
char kind = spec[*pos];
- assert(spec[*pos] == '^' || spec[*pos] == '~');
+ GIT_ASSERT_ARG(spec[*pos] == '^' || spec[*pos] == '~');
accumulated = 0;
@@ -676,7 +676,10 @@ static int revparse(
bool should_return_reference = true;
- assert(object_out && reference_out && repo && spec);
+ GIT_ASSERT_ARG(object_out);
+ GIT_ASSERT_ARG(reference_out);
+ GIT_ASSERT_ARG(repo);
+ GIT_ASSERT_ARG(spec);
*object_out = NULL;
*reference_out = NULL;
@@ -882,7 +885,9 @@ int git_revparse(
const char *dotdot;
int error = 0;
- assert(revspec && repo && spec);
+ GIT_ASSERT_ARG(revspec);
+ GIT_ASSERT_ARG(repo);
+ GIT_ASSERT_ARG(spec);
memset(revspec, 0x0, sizeof(*revspec));