aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/blogc/file.c11
-rw-r--r--src/blogc/file.h2
-rw-r--r--src/blogc/loader.c13
3 files changed, 7 insertions, 19 deletions
diff --git a/src/blogc/file.c b/src/blogc/file.c
index 71598b8..518c665 100644
--- a/src/blogc/file.c
+++ b/src/blogc/file.c
@@ -68,14 +68,3 @@ blogc_file_get_contents(const char *path, size_t *len, bc_error_t **err)
return bc_string_free(str, false);
}
-
-
-int
-blogc_fprintf(FILE *stream, const char *format, ...)
-{
- va_list ap;
- va_start(ap, format);
- int rv = vfprintf(stream, format, ap);
- va_end(ap);
- return rv;
-}
diff --git a/src/blogc/file.h b/src/blogc/file.h
index 8213573..6a0e094 100644
--- a/src/blogc/file.h
+++ b/src/blogc/file.h
@@ -10,12 +10,10 @@
#define _FILE_H
#include <stddef.h>
-#include <stdio.h>
#include "../common/error.h"
#define BLOGC_FILE_CHUNK_SIZE 1024
char* blogc_file_get_contents(const char *path, size_t *len, bc_error_t **err);
-int blogc_fprintf(FILE *stream, const char *format, ...);
#endif /* _FILE_H */
diff --git a/src/blogc/loader.c b/src/blogc/loader.c
index e8de75d..754723b 100644
--- a/src/blogc/loader.c
+++ b/src/blogc/loader.c
@@ -166,12 +166,13 @@ blogc_source_parse_from_files(bc_trie_t *conf, bc_slist_t *l, bc_error_t **err)
rv = bc_slist_append(rv, s);
}
- if (with_date > 0 && with_date < bc_slist_length(rv))
- // fatal error, maybe?
- blogc_fprintf(stderr,
- "blogc: warning: 'DATE' variable provided for at least one source "
- "file, but not for all source files. This means that you may get "
- "wrong values for 'DATE_FIRST' and 'DATE_LAST' variables.\n");
+ if (with_date > 0 && with_date < bc_slist_length(rv)) {
+ *err = bc_error_new_printf(BLOGC_ERROR_LOADER,
+ "'DATE' variable provided for at least one source file, but not "
+ "for all source files. It must be provided for all files.\n");
+ bc_slist_free_full(rv, (bc_free_func_t) bc_trie_free);
+ rv = NULL;
+ }
bool first = true;
for (bc_slist_t *tmp = rv; tmp != NULL; tmp = tmp->next) {