diff options
-rw-r--r-- | compromyse.xyz/posts/a.html | 2 | ||||
-rw-r--r-- | include/lexer.h | 7 | ||||
-rw-r--r-- | src/engine.c | 1 | ||||
-rw-r--r-- | src/lexer.c | 8 | ||||
-rw-r--r-- | src/template.c | 5 |
5 files changed, 5 insertions, 18 deletions
diff --git a/compromyse.xyz/posts/a.html b/compromyse.xyz/posts/a.html index 8237d7f..79d75da 100644 --- a/compromyse.xyz/posts/a.html +++ b/compromyse.xyz/posts/a.html @@ -1,4 +1,4 @@ -title = A.html +title: A.html --- <p>a.html</p> diff --git a/include/lexer.h b/include/lexer.h index 7d9a955..d62b0d3 100644 --- a/include/lexer.h +++ b/include/lexer.h @@ -39,12 +39,7 @@ typedef struct { char *content; } eachdo_operands_t; -typedef struct { - list_t *matches; - list_t *directives; -} lex_t; - -lex_t *lex(char *buffer); +list_t *lex(char *buffer); directive_t *find_directive(char *content, key_match_t *match); key_match_t *find_next_key(char *buffer, size_t skip); char *find_contentfor_value(list_t *content_headers, char *key); diff --git a/src/engine.c b/src/engine.c index 3b8276f..13fa6bc 100644 --- a/src/engine.c +++ b/src/engine.c @@ -1,7 +1,6 @@ #include "util.h" #define _GNU_SOURCE -#include <config.h> #include <copy.h> #include <engine.h> #include <filehandler.h> diff --git a/src/lexer.c b/src/lexer.c index 56802d1..b96e3a5 100644 --- a/src/lexer.c +++ b/src/lexer.c @@ -9,12 +9,10 @@ #include <string.h> #include <util.h> -lex_t * +list_t * lex(char *buffer) { - lex_t *out = malloc(sizeof(lex_t)); list_t *directives = list_create(sizeof(directive_t)); - list_t *matches = list_create(sizeof(key_match_t)); size_t current_offset = 0; while (true) { @@ -55,9 +53,7 @@ lex(char *buffer) list_add(directives, raw_directive); } - out->directives = directives; - out->matches = matches; - return out; + return directives; } key_match_t * diff --git a/src/template.c b/src/template.c index ed6d9e0..b3536cc 100644 --- a/src/template.c +++ b/src/template.c @@ -28,11 +28,8 @@ template_create(void) fclose(base); ingest(&buffer); - lex_t *lexed = lex(buffer); - template->components = lexed->directives; + template->components = lex(buffer); - list_delete(lexed->matches); - free(lexed); free(buffer); return template; } |