diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/engine.c | 21 | ||||
-rw-r--r-- | src/lexer.c | 7 |
2 files changed, 23 insertions, 5 deletions
diff --git a/src/engine.c b/src/engine.c index 5f4c51a..7477d16 100644 --- a/src/engine.c +++ b/src/engine.c @@ -11,6 +11,8 @@ #include <stdlib.h> #include <string.h> +#define DEBUG + extern msg_t *msg; void @@ -69,6 +71,21 @@ handle_contentfor(char **buffer, free(operand); } +void +handle_for(char **buffer, key_match_t *match, directive_t *directive) +{ + for_operand_t *operand = directive->operands; + +#ifdef DEBUG + printf("KEY: %s\n", operand->key); + printf("SOURCE: %s\n", operand->source); + printf("CONTENT: %s\n", operand->content); + exit(1); +#endif + + free(operand); +} + list_t * ingest(char **buffer) { @@ -108,7 +125,11 @@ ingest(char **buffer) case CONTENTFOR: handle_contentfor(buffer, match, directive, content_headers); break; + case FOR: + handle_for(buffer, match, directive); + break; + case ENDFOR: case BODY: case CONTENT: case ENDCONTENT: diff --git a/src/lexer.c b/src/lexer.c index 24a8876..caddf17 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -165,6 +165,7 @@ lexer_handle_contentfor(directive_t *directive, operands->content = strndup(buffer, new_match->offset); operands->length = match->offset + match->length + new_match->offset + new_match->length; + free(new_match); directive->operands = operands; } @@ -223,11 +224,7 @@ lexer_handle_for(directive_t *directive, } operands->content = strndup(buffer, new_match->offset); - - printf("KEY: %s\n", operands->key); - printf("SOURCE: %s\n", operands->source); - printf("CONTENT: %s\n", operands->content); - exit(1); + free(new_match); directive->operands = operands; } |