aboutsummaryrefslogtreecommitdiffstats
path: root/src/template-parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/template-parser.c')
-rw-r--r--src/template-parser.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/template-parser.c b/src/template-parser.c
index a00a2c2..f6912df 100644
--- a/src/template-parser.c
+++ b/src/template-parser.c
@@ -13,7 +13,7 @@
#include <stdbool.h>
#include <string.h>
-#include <squareball.h>
+#include "utils/utils.h"
#include "template-parser.h"
#include "error.h"
@@ -48,7 +48,7 @@ typedef enum {
} blogc_template_parser_block_state_t;
-sb_slist_t*
+b_slist_t*
blogc_template_parse(const char *src, size_t src_len, blogc_error_t **err)
{
if (err == NULL || *err != NULL)
@@ -66,7 +66,7 @@ blogc_template_parse(const char *src, size_t src_len, blogc_error_t **err)
unsigned int if_count = 0;
- sb_slist_t *stmts = NULL;
+ b_slist_t *stmts = NULL;
blogc_template_stmt_t *stmt = NULL;
blogc_template_parser_state_t state = TEMPLATE_START;
@@ -81,12 +81,12 @@ blogc_template_parse(const char *src, size_t src_len, blogc_error_t **err)
case TEMPLATE_START:
if (last) {
- stmt = sb_malloc(sizeof(blogc_template_stmt_t));
+ stmt = b_malloc(sizeof(blogc_template_stmt_t));
stmt->type = type;
- stmt->value = sb_strndup(src + start, src_len - start);
+ stmt->value = b_strndup(src + start, src_len - start);
stmt->op = 0;
stmt->value2 = NULL;
- stmts = sb_slist_append(stmts, stmt);
+ stmts = b_slist_append(stmts, stmt);
stmt = NULL;
}
if (c == '{') {
@@ -102,12 +102,12 @@ blogc_template_parse(const char *src, size_t src_len, blogc_error_t **err)
else
state = TEMPLATE_VARIABLE_START;
if (end > start) {
- stmt = sb_malloc(sizeof(blogc_template_stmt_t));
+ stmt = b_malloc(sizeof(blogc_template_stmt_t));
stmt->type = type;
- stmt->value = sb_strndup(src + start, end - start);
+ stmt->value = b_strndup(src + start, end - start);
stmt->op = 0;
stmt->value2 = NULL;
- stmts = sb_slist_append(stmts, stmt);
+ stmts = b_slist_append(stmts, stmt);
stmt = NULL;
}
break;
@@ -426,19 +426,19 @@ blogc_template_parse(const char *src, size_t src_len, blogc_error_t **err)
op_start = 0;
op_end = 0;
}
- stmt = sb_malloc(sizeof(blogc_template_stmt_t));
+ stmt = b_malloc(sizeof(blogc_template_stmt_t));
stmt->type = type;
stmt->value = NULL;
stmt->op = tmp_op;
stmt->value2 = NULL;
if (end > start)
- stmt->value = sb_strndup(src + start, end - start);
+ stmt->value = b_strndup(src + start, end - start);
if (end2 > start2) {
- stmt->value2 = sb_strndup(src + start2, end2 - start2);
+ stmt->value2 = b_strndup(src + start2, end2 - start2);
start2 = 0;
end2 = 0;
}
- stmts = sb_slist_append(stmts, stmt);
+ stmts = b_slist_append(stmts, stmt);
stmt = NULL;
state = TEMPLATE_START;
type = BLOGC_TEMPLATE_CONTENT_STMT;
@@ -485,9 +485,9 @@ blogc_template_parse(const char *src, size_t src_len, blogc_error_t **err)
void
-blogc_template_free_stmts(sb_slist_t *stmts)
+blogc_template_free_stmts(b_slist_t *stmts)
{
- for (sb_slist_t *tmp = stmts; tmp != NULL; tmp = tmp->next) {
+ for (b_slist_t *tmp = stmts; tmp != NULL; tmp = tmp->next) {
blogc_template_stmt_t *data = tmp->data;
if (data == NULL)
continue;
@@ -495,5 +495,5 @@ blogc_template_free_stmts(sb_slist_t *stmts)
free(data->value2);
free(data);
}
- sb_slist_free(stmts);
+ b_slist_free(stmts);
}