aboutsummaryrefslogtreecommitdiff
path: root/gcc/system.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/system.h')
-rw-r--r--gcc/system.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/system.h b/gcc/system.h
index adde3e2..4ac656c 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -1305,4 +1305,17 @@ startswith (const char *str, const char *prefix)
return strncmp (str, prefix, strlen (prefix)) == 0;
}
+/* Return true if STR string ends with SUFFIX. */
+
+static inline bool
+endswith (const char *str, const char *suffix)
+{
+ size_t str_len = strlen (str);
+ size_t suffix_len = strlen (suffix);
+ if (str_len < suffix_len)
+ return false;
+
+ return memcmp (str + str_len - suffix_len, suffix, suffix_len) == 0;
+}
+
#endif /* ! GCC_SYSTEM_H */