aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/template.c5
-rw-r--r--tests/data/inheritance-depth-1/one.tmpl2
2 files changed, 5 insertions, 2 deletions
diff --git a/src/template.c b/src/template.c
index 6949068..105a8c3 100644
--- a/src/template.c
+++ b/src/template.c
@@ -197,6 +197,9 @@ struct env *env_new(char *dirname) {
strcpy(name, de->d_name);
char *tmpl = read_file(name);
+ #if DEBUG
+ printf("Parsing template from file %s: %s\n", name, tmpl);
+ #endif
mpc_ast_t *ast = parse(tmpl);
free(tmpl);
@@ -242,7 +245,7 @@ char *read_file(char *filename) {
}
unsigned int read = 0;
- while ( (read = fread(input, 1, BUFSIZ, f)) > 0) {
+ while ( (read = fread(input + read, 1, BUFSIZ, f)) > 0) {
size += read;
input = realloc(input, size + BUFSIZ);
}
diff --git a/tests/data/inheritance-depth-1/one.tmpl b/tests/data/inheritance-depth-1/one.tmpl
index 05467a6..b900bcf 100644
--- a/tests/data/inheritance-depth-1/one.tmpl
+++ b/tests/data/inheritance-depth-1/one.tmpl
@@ -2,4 +2,4 @@
{% block content %}
Child content
-{% endblock %} \ No newline at end of file
+{% endblock %}