diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-04-27 01:31:02 +0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-04-27 01:31:02 +0200 |
commit | 6153580a13e7e7c48e38fa446572c8adcae08084 (patch) | |
tree | 9be08616aed124c67159bf71fccd3a286bc0fe81 /src | |
parent | c5e4f4c2d29831151bdce1802787b9cf012c3e5e (diff) | |
download | blogc-6153580a13e7e7c48e38fa446572c8adcae08084.tar.gz blogc-6153580a13e7e7c48e38fa446572c8adcae08084.tar.bz2 blogc-6153580a13e7e7c48e38fa446572c8adcae08084.zip |
Revert "*: use squareball error infrastructure"
This reverts commit a2b3551dfb9460470bd79f5648bf597c517c40d4.
Diffstat (limited to 'src')
-rw-r--r-- | src/datetime-parser.c | 58 | ||||
-rw-r--r-- | src/datetime-parser.h | 2 | ||||
-rw-r--r-- | src/error.c | 47 | ||||
-rw-r--r-- | src/error.h | 15 | ||||
-rw-r--r-- | src/file.c | 4 | ||||
-rw-r--r-- | src/file.h | 2 | ||||
-rw-r--r-- | src/loader.c | 12 | ||||
-rw-r--r-- | src/loader.h | 6 | ||||
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/renderer.c | 4 | ||||
-rw-r--r-- | src/source-parser.c | 4 | ||||
-rw-r--r-- | src/source-parser.h | 2 | ||||
-rw-r--r-- | src/template-parser.c | 8 | ||||
-rw-r--r-- | src/template-parser.h | 2 |
14 files changed, 105 insertions, 65 deletions
diff --git a/src/datetime-parser.c b/src/datetime-parser.c index 0fa7aaf..0aeb702 100644 --- a/src/datetime-parser.c +++ b/src/datetime-parser.c @@ -47,14 +47,14 @@ typedef enum { char* blogc_convert_datetime(const char *orig, const char *format, - sb_error_t **err) + blogc_error_t **err) { if (err == NULL || *err != NULL) return NULL; #ifndef HAVE_TIME_H - *err = sb_error_new(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new(BLOGC_WARNING_DATETIME_PARSER, "Your operating system does not supports the datetime functionalities " "used by blogc. Sorry."); return NULL; @@ -80,7 +80,7 @@ blogc_convert_datetime(const char *orig, const char *format, state = DATETIME_SECOND_YEAR; break; } - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid first digit of year. " "Found '%c', must be integer >= 0 and <= 9.", c); break; @@ -91,7 +91,7 @@ blogc_convert_datetime(const char *orig, const char *format, state = DATETIME_THIRD_YEAR; break; } - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid second digit of year. " "Found '%c', must be integer >= 0 and <= 9.", c); break; @@ -102,7 +102,7 @@ blogc_convert_datetime(const char *orig, const char *format, state = DATETIME_FOURTH_YEAR; break; } - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid third digit of year. " "Found '%c', must be integer >= 0 and <= 9.", c); break; @@ -111,7 +111,7 @@ blogc_convert_datetime(const char *orig, const char *format, if (c >= '0' && c <= '9') { tmp += c - diff - 1900; if (tmp < 0) { - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid year. Found %d, must be >= 1900.", tmp + 1900); break; @@ -120,7 +120,7 @@ blogc_convert_datetime(const char *orig, const char *format, state = DATETIME_FIRST_HYPHEN; break; } - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid fourth digit of year. " "Found '%c', must be integer >= 0 and <= 9.", c); break; @@ -131,7 +131,7 @@ blogc_convert_datetime(const char *orig, const char *format, state = DATETIME_FIRST_MONTH; break; } - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid separator between year and month. " "Found '%c', must be '-'.", c); break; @@ -142,7 +142,7 @@ blogc_convert_datetime(const char *orig, const char *format, state = DATETIME_SECOND_MONTH; break; } - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid first digit of month. " "Found '%c', must be integer >= 0 and <= 1.", c); break; @@ -151,7 +151,7 @@ blogc_convert_datetime(const char *orig, const char *format, if (c >= '0' && c <= '9') { tmp += c - diff - 1; if (tmp < 0 || tmp > 11) { - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid month. Found %d, must be >= 1 and <= 12.", tmp + 1); break; @@ -160,7 +160,7 @@ blogc_convert_datetime(const char *orig, const char *format, state = DATETIME_SECOND_HYPHEN; break; } - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid second digit of month. " "Found '%c', must be integer >= 0 and <= 9.", c); break; @@ -171,7 +171,7 @@ blogc_convert_datetime(const char *orig, const char *format, state = DATETIME_FIRST_DAY; break; } - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid separator between month and day. " "Found '%c', must be '-'.", c); break; @@ -182,7 +182,7 @@ blogc_convert_datetime(const char *orig, const char *format, state = DATETIME_SECOND_DAY; break; } - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid first digit of day. " "Found '%c', must be integer >= 0 and <= 3.", c); break; @@ -191,7 +191,7 @@ blogc_convert_datetime(const char *orig, const char *format, if (c >= '0' && c <= '9') { tmp += c - diff; if (tmp < 1 || tmp > 31) { - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid day. Found %d, must be >= 1 and <= 31.", tmp); break; @@ -200,7 +200,7 @@ blogc_convert_datetime(const char *orig, const char *format, state = DATETIME_SPACE; break; } - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid second digit of day. " "Found '%c', must be integer >= 0 and <= 9.", c); break; @@ -211,7 +211,7 @@ blogc_convert_datetime(const char *orig, const char *format, state = DATETIME_FIRST_HOUR; break; } - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid separator between date and time. " "Found '%c', must be ' ' (empty space).", c); break; @@ -222,7 +222,7 @@ blogc_convert_datetime(const char *orig, const char *format, state = DATETIME_SECOND_HOUR; break; } - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid first digit of hours. " "Found '%c', must be integer >= 0 and <= 2.", c); break; @@ -231,7 +231,7 @@ blogc_convert_datetime(const char *orig, const char *format, if (c >= '0' && c <= '9') { tmp += c - diff; if (tmp < 0 || tmp > 23) { - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid hours. Found %d, must be >= 0 and <= 23.", tmp); break; @@ -240,7 +240,7 @@ blogc_convert_datetime(const char *orig, const char *format, state = DATETIME_FIRST_COLON; break; } - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid second digit of hours. " "Found '%c', must be integer >= 0 and <= 9.", c); break; @@ -251,7 +251,7 @@ blogc_convert_datetime(const char *orig, const char *format, state = DATETIME_FIRST_MINUTE; break; } - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid separator between hours and minutes. " "Found '%c', must be ':'.", c); break; @@ -262,7 +262,7 @@ blogc_convert_datetime(const char *orig, const char *format, state = DATETIME_SECOND_MINUTE; break; } - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid first digit of minutes. " "Found '%c', must be integer >= 0 and <= 5.", c); break; @@ -274,7 +274,7 @@ blogc_convert_datetime(const char *orig, const char *format, // this won't happen because we are restricting the digits // to 00-59 already, but lets keep the code here for // reference. - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid minutes. Found %d, must be >= 0 and <= 59.", tmp); break; @@ -283,7 +283,7 @@ blogc_convert_datetime(const char *orig, const char *format, state = DATETIME_SECOND_COLON; break; } - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid second digit of minutes. " "Found '%c', must be integer >= 0 and <= 9.", c); break; @@ -294,7 +294,7 @@ blogc_convert_datetime(const char *orig, const char *format, state = DATETIME_FIRST_SECOND; break; } - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid separator between minutes and seconds. " "Found '%c', must be ':'.", c); break; @@ -305,7 +305,7 @@ blogc_convert_datetime(const char *orig, const char *format, state = DATETIME_SECOND_SECOND; break; } - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid first digit of seconds. " "Found '%c', must be integer >= 0 and <= 6.", c); break; @@ -314,7 +314,7 @@ blogc_convert_datetime(const char *orig, const char *format, if (c >= '0' && c <= '9') { tmp += c - diff; if (tmp < 0 || tmp > 60) { - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid seconds. Found %d, must be >= 0 and <= 60.", tmp); break; @@ -323,7 +323,7 @@ blogc_convert_datetime(const char *orig, const char *format, state = DATETIME_DONE; break; } - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid second digit of seconds. " "Found '%c', must be integer >= 0 and <= 9.", c); break; @@ -355,7 +355,7 @@ blogc_convert_datetime(const char *orig, const char *format, case DATETIME_SECOND_MINUTE: case DATETIME_FIRST_SECOND: case DATETIME_SECOND_SECOND: - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Invalid datetime string. " "Found '%s', formats allowed are: 'yyyy-mm-dd hh:mm:ss', " "'yyyy-mm-dd hh:ss', 'yyyy-mm-dd hh' and 'yyyy-mm-dd'.", @@ -374,7 +374,7 @@ blogc_convert_datetime(const char *orig, const char *format, char buf[1024]; if (0 == strftime(buf, sizeof(buf), format, &t)) { - *err = sb_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, + *err = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER, "Failed to format DATE variable, FORMAT is too long: %s", format); return NULL; diff --git a/src/datetime-parser.h b/src/datetime-parser.h index b2e65a1..a5087b3 100644 --- a/src/datetime-parser.h +++ b/src/datetime-parser.h @@ -12,6 +12,6 @@ #include "error.h" char* blogc_convert_datetime(const char *orig, const char *format, - sb_error_t **err); + blogc_error_t **err); #endif /* _DATETIME_H */ diff --git a/src/error.c b/src/error.c index 619ae01..f05049c 100644 --- a/src/error.c +++ b/src/error.c @@ -18,8 +18,31 @@ #include "error.h" -sb_error_t* -blogc_error_parser(blogc_error_code_t type, const char *src, size_t src_len, +blogc_error_t* +blogc_error_new(blogc_error_type_t type, const char *msg) +{ + blogc_error_t *err = sb_malloc(sizeof(blogc_error_t)); + err->type = type; + err->msg = sb_strdup(msg); + return err; +} + + +blogc_error_t* +blogc_error_new_printf(blogc_error_type_t type, const char *format, ...) +{ + va_list ap; + va_start(ap, format); + char *tmp = sb_strdup_vprintf(format, ap); + va_end(ap); + blogc_error_t *rv = blogc_error_new(type, tmp); + free(tmp); + return rv; +} + + +blogc_error_t* +blogc_error_parser(blogc_error_type_t type, const char *src, size_t src_len, size_t current, const char *format, ...) { va_list ap; @@ -67,12 +90,12 @@ blogc_error_parser(blogc_error_code_t type, const char *src, size_t src_len, char *line = sb_strndup(src + linestart, lineend - linestart); - sb_error_t *rv = NULL; + blogc_error_t *rv = NULL; if (line[0] == '\0') // "near" message isn't useful if line is empty - rv = sb_error_new(type, msg); + rv = blogc_error_new(type, msg); else - rv = sb_error_new_printf(type, + rv = blogc_error_new_printf(type, "%s\nError occurred near line %d, position %d: %s", msg, lineno, pos, line); @@ -84,12 +107,12 @@ blogc_error_parser(blogc_error_code_t type, const char *src, size_t src_len, void -blogc_error_print(sb_error_t *err) +blogc_error_print(blogc_error_t *err) { if (err == NULL) return; - switch(err->code) { + switch(err->type) { case BLOGC_ERROR_SOURCE_PARSER: fprintf(stderr, "blogc: error: source: %s\n", err->msg); break; @@ -106,3 +129,13 @@ blogc_error_print(sb_error_t *err) fprintf(stderr, "blogc: error: %s\n", err->msg); } } + + +void +blogc_error_free(blogc_error_t *err) +{ + if (err == NULL) + return; + free(err->msg); + free(err); +} diff --git a/src/error.h b/src/error.h index e02afed..caa86b0 100644 --- a/src/error.h +++ b/src/error.h @@ -11,17 +11,24 @@ #include <stdlib.h> #include <stdarg.h> -#include <squareball.h> typedef enum { BLOGC_ERROR_SOURCE_PARSER = 1, BLOGC_ERROR_TEMPLATE_PARSER, BLOGC_ERROR_LOADER, BLOGC_WARNING_DATETIME_PARSER, -} blogc_error_code_t; +} blogc_error_type_t; -sb_error_t* blogc_error_parser(blogc_error_code_t type, const char *src, +typedef struct { + char *msg; + blogc_error_type_t type; +} blogc_error_t; + +blogc_error_t* blogc_error_new(blogc_error_type_t type, const char *msg); +blogc_error_t* blogc_error_new_printf(blogc_error_type_t type, const char *format, ...); +blogc_error_t* blogc_error_parser(blogc_error_type_t type, const char *src, size_t src_len, size_t current, const char *format, ...); -void blogc_error_print(sb_error_t *err); +void blogc_error_print(blogc_error_t *err); +void blogc_error_free(blogc_error_t *err); #endif /* _ERROR_H */ @@ -23,7 +23,7 @@ char* -blogc_file_get_contents(const char *path, size_t *len, sb_error_t **err) +blogc_file_get_contents(const char *path, size_t *len, blogc_error_t **err) { if (path == NULL || err == NULL || *err != NULL) return NULL; @@ -33,7 +33,7 @@ blogc_file_get_contents(const char *path, size_t *len, sb_error_t **err) if (fp == NULL) { int tmp_errno = errno; - *err = sb_error_new_printf(BLOGC_ERROR_LOADER, + *err = blogc_error_new_printf(BLOGC_ERROR_LOADER, "Failed to open file (%s): %s", path, strerror(tmp_errno)); return NULL; } @@ -15,7 +15,7 @@ #define BLOGC_FILE_CHUNK_SIZE 1024 -char* blogc_file_get_contents(const char *path, size_t *len, sb_error_t **err); +char* blogc_file_get_contents(const char *path, size_t *len, blogc_error_t **err); int blogc_fprintf(FILE *stream, const char *format, ...); #endif /* _FILE_H */ diff --git a/src/loader.c b/src/loader.c index fd184e5..8008c3a 100644 --- a/src/loader.c +++ b/src/loader.c @@ -60,7 +60,7 @@ blogc_get_filename(const char *f) sb_slist_t* -blogc_template_parse_from_file(const char *f, sb_error_t **err) +blogc_template_parse_from_file(const char *f, blogc_error_t **err) { if (err == NULL || *err != NULL) return NULL; @@ -75,7 +75,7 @@ blogc_template_parse_from_file(const char *f, sb_error_t **err) sb_trie_t* -blogc_source_parse_from_file(const char *f, sb_error_t **err) +blogc_source_parse_from_file(const char *f, blogc_error_t **err) { if (err == NULL || *err != NULL) return NULL; @@ -98,9 +98,9 @@ blogc_source_parse_from_file(const char *f, sb_error_t **err) sb_slist_t* -blogc_source_parse_from_files(sb_trie_t *conf, sb_slist_t *l, sb_error_t **err) +blogc_source_parse_from_files(sb_trie_t *conf, sb_slist_t *l, blogc_error_t **err) { - sb_error_t *tmp_err = NULL; + blogc_error_t *tmp_err = NULL; sb_slist_t *rv = NULL; unsigned int with_date = 0; @@ -125,10 +125,10 @@ blogc_source_parse_from_files(sb_trie_t *conf, sb_slist_t *l, sb_error_t **err) char *f = tmp->data; sb_trie_t *s = blogc_source_parse_from_file(f, &tmp_err); if (s == NULL) { - *err = sb_error_new_printf(BLOGC_ERROR_LOADER, + *err = blogc_error_new_printf(BLOGC_ERROR_LOADER, "An error occurred while parsing source file: %s\n\n%s", f, tmp_err->msg); - sb_error_free(tmp_err); + blogc_error_free(tmp_err); tmp_err = NULL; sb_slist_free_full(rv, (sb_free_func_t) sb_trie_free); rv = NULL; diff --git a/src/loader.h b/src/loader.h index 8b0460e..080aff6 100644 --- a/src/loader.h +++ b/src/loader.h @@ -13,9 +13,9 @@ #include "error.h" char* blogc_get_filename(const char *f); -sb_slist_t* blogc_template_parse_from_file(const char *f, sb_error_t **err); -sb_trie_t* blogc_source_parse_from_file(const char *f, sb_error_t **err); +sb_slist_t* blogc_template_parse_from_file(const char *f, blogc_error_t **err); +sb_trie_t* blogc_source_parse_from_file(const char *f, blogc_error_t **err); sb_slist_t* blogc_source_parse_from_files(sb_trie_t *conf, sb_slist_t *l, - sb_error_t **err); + blogc_error_t **err); #endif /* _LOADER_H */ @@ -210,7 +210,7 @@ main(int argc, char **argv) goto cleanup; } - sb_error_t *err = NULL; + blogc_error_t *err = NULL; sb_slist_t *s = blogc_source_parse_from_files(config, sources, &err); if (err != NULL) { @@ -274,7 +274,7 @@ cleanup3: blogc_template_free_stmts(l); cleanup2: sb_slist_free_full(s, (sb_free_func_t) sb_trie_free); - sb_error_free(err); + blogc_error_free(err); cleanup: sb_trie_free(config); free(template); diff --git a/src/renderer.c b/src/renderer.c index eb58e0d..a7a7dd7 100644 --- a/src/renderer.c +++ b/src/renderer.c @@ -46,11 +46,11 @@ blogc_format_date(const char *date, sb_trie_t *global, sb_trie_t *local) if (date_format == NULL) return sb_strdup(date); - sb_error_t *err = NULL; + blogc_error_t *err = NULL; char *rv = blogc_convert_datetime(date, date_format, &err); if (err != NULL) { blogc_error_print(err); - sb_error_free(err); + blogc_error_free(err); return sb_strdup(date); } return rv; diff --git a/src/source-parser.c b/src/source-parser.c index 6e026d2..67c3717 100644 --- a/src/source-parser.c +++ b/src/source-parser.c @@ -31,7 +31,7 @@ typedef enum { sb_trie_t* -blogc_source_parse(const char *src, size_t src_len, sb_error_t **err) +blogc_source_parse(const char *src, size_t src_len, blogc_error_t **err) { if (err == NULL || *err != NULL) return NULL; @@ -97,7 +97,7 @@ blogc_source_parse(const char *src, size_t src_len, sb_error_t **err) ((current - start == 13) && (0 == strncmp("BLOGC_VERSION", src + start, 13)))) { - *err = sb_error_new_printf(BLOGC_ERROR_SOURCE_PARSER, + *err = blogc_error_new_printf(BLOGC_ERROR_SOURCE_PARSER, "'%s' variable is forbidden in source files. It will " "be set for you by the compiler.", key); break; diff --git a/src/source-parser.h b/src/source-parser.h index fb5306c..460aedb 100644 --- a/src/source-parser.h +++ b/src/source-parser.h @@ -14,6 +14,6 @@ #include "error.h" sb_trie_t* blogc_source_parse(const char *src, size_t src_len, - sb_error_t **err); + blogc_error_t **err); #endif /* _SOURCE_PARSER_H */ diff --git a/src/template-parser.c b/src/template-parser.c index d61f90a..6f23ef1 100644 --- a/src/template-parser.c +++ b/src/template-parser.c @@ -53,7 +53,7 @@ typedef enum { sb_slist_t* -blogc_template_parse(const char *src, size_t src_len, sb_error_t **err) +blogc_template_parse(const char *src, size_t src_len, blogc_error_t **err) { if (err == NULL || *err != NULL) return NULL; @@ -597,14 +597,14 @@ blogc_template_parse(const char *src, size_t src_len, sb_error_t **err) *err = blogc_error_parser(BLOGC_ERROR_TEMPLATE_PARSER, src, src_len, start2 - 1, "Found an open double-quoted string."); else if (if_count != 0) - *err = sb_error_new_printf(BLOGC_ERROR_TEMPLATE_PARSER, + *err = blogc_error_new_printf(BLOGC_ERROR_TEMPLATE_PARSER, "%d open 'ifdef' and/or 'ifndef' statements were not closed!", if_count); else if (block_state != BLOCK_CLOSED) - *err = sb_error_new(BLOGC_ERROR_TEMPLATE_PARSER, + *err = blogc_error_new(BLOGC_ERROR_TEMPLATE_PARSER, "An open block was not closed!"); else if (foreach_open) - *err = sb_error_new(BLOGC_ERROR_TEMPLATE_PARSER, + *err = blogc_error_new(BLOGC_ERROR_TEMPLATE_PARSER, "An open 'foreach' statement was not closed!"); } diff --git a/src/template-parser.h b/src/template-parser.h index 88b46e9..de5113e 100644 --- a/src/template-parser.h +++ b/src/template-parser.h @@ -45,7 +45,7 @@ typedef struct { } blogc_template_stmt_t; sb_slist_t* blogc_template_parse(const char *src, size_t src_len, - sb_error_t **err); + blogc_error_t **err); void blogc_template_free_stmts(sb_slist_t *stmts); #endif /* _TEMPLATE_GRAMMAR_H */ |