diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2019-02-09 02:29:05 +0100 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2019-02-09 02:29:05 +0100 |
commit | 49ed30a5e87e510fd0c14b367110175f9d2fb144 (patch) | |
tree | 348319b8696aa917813c185b1e2e0425b44bf4f9 /src/common | |
parent | 26325e3e684dc87b9751750d2a98ba6a61f8f055 (diff) | |
download | blogc-49ed30a5e87e510fd0c14b367110175f9d2fb144.tar.gz blogc-49ed30a5e87e510fd0c14b367110175f9d2fb144.tar.bz2 blogc-49ed30a5e87e510fd0c14b367110175f9d2fb144.zip |
blogc: template: allow whitespaces in template tags, not just spaces
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/utils.c | 8 | ||||
-rw-r--r-- | src/common/utils.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/common/utils.c b/src/common/utils.c index 530ab6c..692d1ce 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -167,6 +167,14 @@ bc_strdup_printf(const char *format, ...) } +// locale-independent implementation of isspace +bool +bc_isspace(int c) +{ + return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v'; +} + + bool bc_str_starts_with(const char *str, const char *prefix) { diff --git a/src/common/utils.h b/src/common/utils.h index bc3a157..94c3356 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -42,6 +42,7 @@ char* bc_strdup(const char *s); char* bc_strndup(const char *s, size_t n); char* bc_strdup_vprintf(const char *format, va_list ap); char* bc_strdup_printf(const char *format, ...); +bool bc_isspace(int c); bool bc_str_starts_with(const char *str, const char *prefix); bool bc_str_ends_with(const char *str, const char *suffix); char* bc_str_lstrip(char *str); |