aboutsummaryrefslogtreecommitdiff
path: root/src/lexer.c
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2025-06-22 12:55:58 +0530
committerRaghuram Subramani <raghus2247@gmail.com>2025-06-22 12:55:58 +0530
commit18d0d7f3f62216898c76a7404f16743f4086726d (patch)
tree0299c1dbf530b163b855703ad5cacc43e6316fa2 /src/lexer.c
parent751068c825d4eef93aab6f8c708fe0f64cf27323 (diff)
(engine): maintain a list of content headers
Diffstat (limited to 'src/lexer.c')
-rw-r--r--src/lexer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lexer.c b/src/lexer.c
index 8a04df1..1b8cb04 100644
--- a/src/lexer.c
+++ b/src/lexer.c
@@ -82,7 +82,7 @@ found_start:
directive->operands = NULL;
} else if (strncmp(buffer + n, "contentfor", strlen("contentfor")) == 0) {
directive->type = CONTENTFOR;
- contentfor_operands_t *operands = malloc(sizeof(contentfor_operands_t));
+ contentfor_operand_t *operands = malloc(sizeof(contentfor_operand_t));
for (size_t i = n + strlen("contentfor"); i < match->length; i++)
if (isalnum(buffer[i])) {
@@ -125,6 +125,8 @@ found_start:
}
asprintf(&operands->content, "%.*s", new_match->offset, buffer);
+ operands->length = match->offset + match->length + new_match->offset
+ + new_match->length;
free(new_directive);
free(new_match);