summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Romani <fromani@gmail.com>2014-07-06 13:36:02 +0200
committerSebastian Dröge <sebastian@centricular.com>2023-04-12 19:31:42 +0300
commitd710de1642eae89fdc096b61ba1f58dc52af830f (patch)
tree9b8aea21068f0d95d19e372fe52437c8d6a12a94
parentd22fb602e864a15079c4f0bf93a0143ce9617aa9 (diff)
downloadorc-d710de1642eae89fdc096b61ba1f58dc52af830f.tar.gz
parser: move init_function in the parser
Part-of: <https://gitlab.freedesktop.org/gstreamer/orc/-/merge_requests/30>
-rw-r--r--orc/orcparse.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/orc/orcparse.c b/orc/orcparse.c
index b9f31f6..0a54f46 100644
--- a/orc/orcparse.c
+++ b/orc/orcparse.c
@@ -37,6 +37,8 @@ struct _OrcParser {
char *log;
int log_size;
int log_alloc;
+
+ char *init_function;
};
static void orc_parse_get_line (OrcParser *parser);
@@ -58,7 +60,6 @@ orc_parse_full (const char *code, OrcProgram ***programs, char **log)
{
OrcParser _parser;
OrcParser *parser = &_parser;
- char *init_function = NULL;
memset (parser, 0, sizeof(*parser));
@@ -145,13 +146,13 @@ orc_parse_full (const char *code, OrcProgram ***programs, char **log)
orc_program_set_backup_name (parser->program, token[1]);
}
} else if (strcmp (token[0], ".init") == 0) {
- free (init_function);
- init_function = NULL;
+ free (parser->init_function);
+ parser->init_function = NULL;
if (n_tokens < 2) {
orc_parse_log (parser, "error: line %d: .init without function name\n",
parser->line_number);
} else {
- init_function = strdup (token[1]);
+ parser->init_function = strdup (token[1]);
}
} else if (strcmp (token[0], ".flags") == 0) {
int i;
@@ -408,9 +409,9 @@ orc_parse_full (const char *code, OrcProgram ***programs, char **log)
if (orc_vector_has_data (&parser->programs)) {
OrcProgram *prog = ORC_VECTOR_GET_ITEM (&parser->programs, 0, OrcProgram *);
- prog->init_function = init_function;
+ prog->init_function = parser->init_function;
} else {
- free (init_function);
+ free (parser->init_function);
}
*programs = ORC_VECTOR_AS_TYPE (&parser->programs, OrcProgram);
return orc_vector_length (&parser->programs);