diff options
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); |