Skip to content

Commit 5bd139e

Browse files
committed
revparse: use GIT_ASSERT
1 parent 055fbf6 commit 5bd139e

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/revparse.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ static int handle_at_syntax(git_object **out, git_reference **ref, const char *s
317317
git_buf identifier = GIT_BUF_INIT;
318318
git_time_t timestamp;
319319

320-
assert(*out == NULL);
320+
GIT_ASSERT(*out == NULL);
321321

322322
if (git_buf_put(&identifier, spec, identifier_len) < 0)
323323
return -1;
@@ -524,7 +524,7 @@ static int extract_curly_braces_content(git_buf *buf, const char *spec, size_t *
524524
{
525525
git_buf_clear(buf);
526526

527-
assert(spec[*pos] == '^' || spec[*pos] == '@');
527+
GIT_ASSERT_ARG(spec[*pos] == '^' || spec[*pos] == '@');
528528

529529
(*pos)++;
530530

@@ -550,7 +550,7 @@ static int extract_path(git_buf *buf, const char *spec, size_t *pos)
550550
{
551551
git_buf_clear(buf);
552552

553-
assert(spec[*pos] == ':');
553+
GIT_ASSERT_ARG(spec[*pos] == ':');
554554

555555
(*pos)++;
556556

@@ -568,7 +568,7 @@ static int extract_how_many(int *n, const char *spec, size_t *pos)
568568
int parsed, accumulated;
569569
char kind = spec[*pos];
570570

571-
assert(spec[*pos] == '^' || spec[*pos] == '~');
571+
GIT_ASSERT_ARG(spec[*pos] == '^' || spec[*pos] == '~');
572572

573573
accumulated = 0;
574574

@@ -676,7 +676,10 @@ static int revparse(
676676

677677
bool should_return_reference = true;
678678

679-
assert(object_out && reference_out && repo && spec);
679+
GIT_ASSERT_ARG(object_out);
680+
GIT_ASSERT_ARG(reference_out);
681+
GIT_ASSERT_ARG(repo);
682+
GIT_ASSERT_ARG(spec);
680683

681684
*object_out = NULL;
682685
*reference_out = NULL;
@@ -882,7 +885,9 @@ int git_revparse(
882885
const char *dotdot;
883886
int error = 0;
884887

885-
assert(revspec && repo && spec);
888+
GIT_ASSERT_ARG(revspec);
889+
GIT_ASSERT_ARG(repo);
890+
GIT_ASSERT_ARG(spec);
886891

887892
memset(revspec, 0x0, sizeof(*revspec));
888893

0 commit comments

Comments
 (0)