diff options
| author | Patrick Steinhardt <ps@pks.im> | 2017-07-14 14:37:07 +0200 |
|---|---|---|
| committer | Patrick Steinhardt <ps@pks.im> | 2017-11-11 17:06:23 +0000 |
| commit | e72cb769f6b8c11344463a9784fd4d32ded4a685 (patch) | |
| tree | a7802281a702affe81998c0f31530777f854fdf9 /src/parse.h | |
| parent | 252f2eeee0ecc90e5ae21efeadaccc9da666b845 (diff) | |
| download | libgit2-e72cb769f6b8c11344463a9784fd4d32ded4a685.tar.gz | |
parse: implement `git_parse_peek`
Some code parts need to inspect the next few bytes without actually
consuming it yet, for example to examine what content it has to expect
next. Create a new function `git_parse_peek` which returns the next byte
without modifying the parsing context and use it at multiple call sites.
Diffstat (limited to 'src/parse.h')
| -rw-r--r-- | src/parse.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/parse.h b/src/parse.h index 8112eaeef..419014e93 100644 --- a/src/parse.h +++ b/src/parse.h @@ -48,3 +48,9 @@ int git_parse_advance_expected( int git_parse_advance_ws(git_parse_ctx *ctx); int git_parse_advance_nl(git_parse_ctx *ctx); int git_parse_advance_digit(int64_t *out, git_parse_ctx *ctx, int base); + +enum GIT_PARSE_PEEK_FLAGS { + GIT_PARSE_PEEK_SKIP_WHITESPACE = (1 << 0) +}; + +int git_parse_peek(char *out, git_parse_ctx *ctx, int flags); |
