summaryrefslogtreecommitdiff
path: root/src/codegen/codegen_main.c
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-22 22:40:43 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-22 22:40:43 +0000
commited4bbfd8cf4a72fdf4a5d6cba94d537cab340356 (patch)
tree80f520cb36f25a210537b477007b0ac5a24e4b8e /src/codegen/codegen_main.c
parent3d1840e8690bef6e58a208d9ca33857a59a2e852 (diff)
Removing some duplicates and dissecting codegen/parser.
Diffstat (limited to 'src/codegen/codegen_main.c')
-rw-r--r--src/codegen/codegen_main.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/codegen/codegen_main.c b/src/codegen/codegen_main.c
index 97abfc7..7363e61 100644
--- a/src/codegen/codegen_main.c
+++ b/src/codegen/codegen_main.c
@@ -577,13 +577,9 @@ void codegen_node(ParserContext *ctx, ASTNode *node, FILE *out)
}
else
{
- char *lt = strchr(sname, '<');
- if (lt)
+ char *buf = strip_template_suffix(sname);
+ if (buf)
{
- int len = lt - sname;
- char *buf = xmalloc(len + 1);
- strncpy(buf, sname, len);
- buf[len] = 0;
def = find_struct_def_codegen(ctx, buf);
if (def && def->strct.is_template)
{
@@ -623,13 +619,9 @@ void codegen_node(ParserContext *ctx, ASTNode *node, FILE *out)
}
else
{
- char *lt = strchr(sname, '<');
- if (lt)
+ char *buf = strip_template_suffix(sname);
+ if (buf)
{
- int len = lt - sname;
- char *buf = xmalloc(len + 1);
- strncpy(buf, sname, len);
- buf[len] = 0;
def = find_struct_def_codegen(ctx, buf);
if (def && def->strct.is_template)
{