diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2015-12-23 23:45:54 +0100 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2015-12-23 23:45:54 +0100 |
commit | 14e9d7b2299f15efb695b0202f9c1f6a9f7a4ba6 (patch) | |
tree | 31b3d9a6f9f6144b08b852d016b5b4bdfce553ef /src/template-parser.c | |
parent | 8e62072d91193b4894adda9c40544c18c1a01f57 (diff) | |
download | blogc-14e9d7b2299f15efb695b0202f9c1f6a9f7a4ba6.tar.gz blogc-14e9d7b2299f15efb695b0202f9c1f6a9f7a4ba6.tar.bz2 blogc-14e9d7b2299f15efb695b0202f9c1f6a9f7a4ba6.zip |
Revert "build: removing src/utils and replacing with squareball"
This reverts commit 950e6c9148eca244a89d18a21d4ae4e5c3d1c646.
Diffstat (limited to 'src/template-parser.c')
-rw-r--r-- | src/template-parser.c | 32 |
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); } |