diff options
author | Francesco Romani <fromani@gmail.com> | 2014-07-06 14:10:12 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2023-04-12 19:47:42 +0300 |
commit | 197b2565bda9f89c66e761f663b2de5c1ee8e40e (patch) | |
tree | b77c6c33dd2420c2b903d8b2ce85b459a9d2be66 | |
parent | 6f8d15a8ae678db1a4a3cf763b649dd88af54884 (diff) | |
download | orc-197b2565bda9f89c66e761f663b2de5c1ee8e40e.tar.gz |
parser: add has_data helper
to check if a parser has still data to process
Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>
-rw-r--r-- | orc/orcparse.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/orc/orcparse.c b/orc/orcparse.c index d44f09f..1459f94 100644 --- a/orc/orcparse.c +++ b/orc/orcparse.c @@ -48,6 +48,7 @@ static void orc_parse_error_free (OrcParseError *error); static void orc_parse_splat_error (OrcParseError **errors, int n_errors, char **log); static void orc_parse_init (OrcParser *parser, const char *code, int enable_errors); +static int orc_parse_has_data (OrcParser *parser); static void orc_parse_get_line (OrcParser *parser); static void orc_parse_sanity_check (OrcParser *parser, OrcProgram *program); @@ -99,7 +100,7 @@ orc_parse_code (const char *code, OrcProgram ***programs, int *n_programs, orc_parse_init (parser, code, enable_errors); - while (parser->p[0] != 0) { + while (orc_parse_has_data (parser)) { char *p; char *end; char *token[10]; @@ -451,6 +452,12 @@ orc_parse_init (OrcParser *parser, const char *code, int enable_errors) parser->enable_errors = enable_errors; } +static int +orc_parse_has_data (OrcParser *parser) +{ + return parser->p[0] != 0; +} + static void orc_parse_splat_error (OrcParseError **errors, int n_errors, char **log) { |