aboutsummaryrefslogtreecommitdiff
path: root/cstring/include/cstring.h
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2024-02-25 15:08:54 -0800
committer3gg <3gg@shellblade.net>2024-02-25 15:08:54 -0800
commitf24912296c473ac15c12e65c97007fe3ece87dfa (patch)
treef103bbf2c192bc28352f4961da4cb06ada99ef68 /cstring/include/cstring.h
parente153be0be2fb8df6656292daab3fa59963c76737 (diff)
Add function to check for empty string.
Diffstat (limited to 'cstring/include/cstring.h')
-rw-r--r--cstring/include/cstring.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/cstring/include/cstring.h b/cstring/include/cstring.h
index de85b43..991d742 100644
--- a/cstring/include/cstring.h
+++ b/cstring/include/cstring.h
@@ -94,6 +94,8 @@
94 return (a.length == strlen(b)) && strncmp(a.str, b, a.length) == 0; \ 94 return (a.length == strlen(b)) && strncmp(a.str, b, a.length) == 0; \
95 } \ 95 } \
96 \ 96 \
97 static inline bool STRING##_empty(STRING a) { return a.length == 0; } \
98 \
97 static inline STRING STRING##_itoa(int n) { \ 99 static inline STRING STRING##_itoa(int n) { \
98 STRING str = (STRING){0}; \ 100 STRING str = (STRING){0}; \
99 const int written = snprintf(str.str, SIZE, "%d", n); \ 101 const int written = snprintf(str.str, SIZE, "%d", n); \