aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/datetime-parser.c58
-rw-r--r--src/datetime-parser.h2
-rw-r--r--src/error.c47
-rw-r--r--src/error.h15
-rw-r--r--src/file.c4
-rw-r--r--src/file.h2
-rw-r--r--src/loader.c12
-rw-r--r--src/loader.h6
-rw-r--r--src/main.c4
-rw-r--r--src/renderer.c4
-rw-r--r--src/source-parser.c4
-rw-r--r--src/source-parser.h2
-rw-r--r--src/template-parser.c8
-rw-r--r--src/template-parser.h2
14 files changed, 65 insertions, 105 deletions
diff --git a/src/datetime-parser.c b/src/datetime-parser.c
index 0aeb702..0fa7aaf 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,
- blogc_error_t **err)
+ sb_error_t **err)
{
if (err == NULL || *err != NULL)
return NULL;
#ifndef HAVE_TIME_H
- *err = blogc_error_new(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 = blogc_error_new_printf(BLOGC_WARNING_DATETIME_PARSER,
+ *err = sb_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 a5087b3..b2e65a1 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,
- blogc_error_t **err);
+ sb_error_t **err);
#endif /* _DATETIME_H */
diff --git a/src/error.c b/src/error.c
index f05049c..619ae01 100644
--- a/src/error.c
+++ b/src/error.c
@@ -18,31 +18,8 @@
#include "error.h"
-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,
+sb_error_t*
+blogc_error_parser(blogc_error_code_t type, const char *src, size_t src_len,
size_t current, const char *format, ...)
{
va_list ap;
@@ -90,12 +67,12 @@ blogc_error_parser(blogc_error_type_t type, const char *src, size_t src_len,
char *line = sb_strndup(src + linestart, lineend - linestart);
- blogc_error_t *rv = NULL;
+ sb_error_t *rv = NULL;
if (line[0] == '\0') // "near" message isn't useful if line is empty
- rv = blogc_error_new(type, msg);
+ rv = sb_error_new(type, msg);
else
- rv = blogc_error_new_printf(type,
+ rv = sb_error_new_printf(type,
"%s\nError occurred near line %d, position %d: %s", msg, lineno,
pos, line);
@@ -107,12 +84,12 @@ blogc_error_parser(blogc_error_type_t type, const char *src, size_t src_len,
void
-blogc_error_print(blogc_error_t *err)
+blogc_error_print(sb_error_t *err)
{
if (err == NULL)
return;
- switch(err->type) {
+ switch(err->code) {
case BLOGC_ERROR_SOURCE_PARSER:
fprintf(stderr, "blogc: error: source: %s\n", err->msg);
break;
@@ -129,13 +106,3 @@ blogc_error_print(blogc_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 caa86b0..e02afed 100644
--- a/src/error.h
+++ b/src/error.h
@@ -11,24 +11,17 @@
#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_type_t;
+} blogc_error_code_t;
-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,
+sb_error_t* blogc_error_parser(blogc_error_code_t type, const char *src,
size_t src_len, size_t current, const char *format, ...);
-void blogc_error_print(blogc_error_t *err);
-void blogc_error_free(blogc_error_t *err);
+void blogc_error_print(sb_error_t *err);
#endif /* _ERROR_H */
diff --git a/src/file.c b/src/file.c
index dec7c1b..972f433 100644
--- a/src/file.c
+++ b/src/file.c
@@ -23,7 +23,7 @@
char*
-blogc_file_get_contents(const char *path, size_t *len, blogc_error_t **err)
+blogc_file_get_contents(const char *path, size_t *len, sb_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, blogc_error_t **err)
if (fp == NULL) {
int tmp_errno = errno;
- *err = blogc_error_new_printf(BLOGC_ERROR_LOADER,
+ *err = sb_error_new_printf(BLOGC_ERROR_LOADER,
"Failed to open file (%s): %s", path, strerror(tmp_errno));
return NULL;
}
diff --git a/src/file.h b/src/file.h
index 97e5274..9c0674d 100644
--- a/src/file.h
+++ b/src/file.h
@@ -15,7 +15,7 @@
#define BLOGC_FILE_CHUNK_SIZE 1024
-char* blogc_file_get_contents(const char *path, size_t *len, blogc_error_t **err);
+char* blogc_file_get_contents(const char *path, size_t *len, sb_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 8008c3a..fd184e5 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, blogc_error_t **err)
+blogc_template_parse_from_file(const char *f, sb_error_t **err)
{
if (err == NULL || *err != NULL)
return NULL;
@@ -75,7 +75,7 @@ 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)
+blogc_source_parse_from_file(const char *f, sb_error_t **err)
{
if (err == NULL || *err != NULL)
return NULL;
@@ -98,9 +98,9 @@ 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, blogc_error_t **err)
+blogc_source_parse_from_files(sb_trie_t *conf, sb_slist_t *l, sb_error_t **err)
{
- blogc_error_t *tmp_err = NULL;
+ sb_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, blogc_error_t **er
char *f = tmp->data;
sb_trie_t *s = blogc_source_parse_from_file(f, &tmp_err);
if (s == NULL) {
- *err = blogc_error_new_printf(BLOGC_ERROR_LOADER,
+ *err = sb_error_new_printf(BLOGC_ERROR_LOADER,
"An error occurred while parsing source file: %s\n\n%s",
f, tmp_err->msg);
- blogc_error_free(tmp_err);
+ sb_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 080aff6..8b0460e 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, blogc_error_t **err);
-sb_trie_t* blogc_source_parse_from_file(const char *f, blogc_error_t **err);
+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_source_parse_from_files(sb_trie_t *conf, sb_slist_t *l,
- blogc_error_t **err);
+ sb_error_t **err);
#endif /* _LOADER_H */
diff --git a/src/main.c b/src/main.c
index 143c836..709b37e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -210,7 +210,7 @@ main(int argc, char **argv)
goto cleanup;
}
- blogc_error_t *err = NULL;
+ sb_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);
- blogc_error_free(err);
+ sb_error_free(err);
cleanup:
sb_trie_free(config);
free(template);
diff --git a/src/renderer.c b/src/renderer.c
index a7a7dd7..eb58e0d 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);
- blogc_error_t *err = NULL;
+ sb_error_t *err = NULL;
char *rv = blogc_convert_datetime(date, date_format, &err);
if (err != NULL) {
blogc_error_print(err);
- blogc_error_free(err);
+ sb_error_free(err);
return sb_strdup(date);
}
return rv;
diff --git a/src/source-parser.c b/src/source-parser.c
index e3662a2..1047f06 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, blogc_error_t **err)
+blogc_source_parse(const char *src, size_t src_len, sb_error_t **err)
{
if (err == NULL || *err != NULL)
return NULL;
@@ -97,7 +97,7 @@ blogc_source_parse(const char *src, size_t src_len, blogc_error_t **err)
((current - start == 13) &&
(0 == strncmp("BLOGC_VERSION", src + start, 13))))
{
- *err = blogc_error_new_printf(BLOGC_ERROR_SOURCE_PARSER,
+ *err = sb_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 460aedb..fb5306c 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,
- blogc_error_t **err);
+ sb_error_t **err);
#endif /* _SOURCE_PARSER_H */
diff --git a/src/template-parser.c b/src/template-parser.c
index 6f23ef1..d61f90a 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, blogc_error_t **err)
+blogc_template_parse(const char *src, size_t src_len, sb_error_t **err)
{
if (err == NULL || *err != NULL)
return NULL;
@@ -597,14 +597,14 @@ blogc_template_parse(const char *src, size_t src_len, blogc_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 = blogc_error_new_printf(BLOGC_ERROR_TEMPLATE_PARSER,
+ *err = sb_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 = blogc_error_new(BLOGC_ERROR_TEMPLATE_PARSER,
+ *err = sb_error_new(BLOGC_ERROR_TEMPLATE_PARSER,
"An open block was not closed!");
else if (foreach_open)
- *err = blogc_error_new(BLOGC_ERROR_TEMPLATE_PARSER,
+ *err = sb_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 de5113e..88b46e9 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,
- blogc_error_t **err);
+ sb_error_t **err);
void blogc_template_free_stmts(sb_slist_t *stmts);
#endif /* _TEMPLATE_GRAMMAR_H */