aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.c')
-rw-r--r--src/common.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/common.c b/src/common.c
index 3553419..4e747bb 100644
--- a/src/common.c
+++ b/src/common.c
@@ -11,6 +11,14 @@ void fatal_error(const char* msg, ...) {
#define unimplemented() fatal_error("%s:%d: unimplemented", __FILE__, __LINE__)
+BOOL str_ends_with(const char* s, const char* suffix) {
+ size_t l1 = strlen(s);
+ size_t l2 = strlen(suffix);
+ if (l1 < l2)
+ return FALSE;
+ return strcmp(s + l1 - l2, suffix) == 0;
+}
+
struct StrBuilder {
size_t len;
size_t capacity;