From b8825ed09287cd5289b98cbc2c5167190142f198 Mon Sep 17 00:00:00 2001 From: Chris Michael Date: Thu, 12 Feb 2015 13:44:53 -0500 Subject: [PATCH] add our own str_has_prefix function which ignores case Signed-off-by: Chris Michael --- src/bin/utils.c | 12 ++++++++++++ src/bin/utils.h | 1 + 2 files changed, 13 insertions(+) diff --git a/src/bin/utils.c b/src/bin/utils.c index 0dcc4be..7077860 100644 --- a/src/bin/utils.c +++ b/src/bin/utils.c @@ -608,3 +608,15 @@ _util_local_path_get(const Evas_Object *obj, const char *relpath) else return _cwd_path_get(obj, relpath); } + +Eina_Bool +_util_str_has_prefix(const char *str, const char *prefix) +{ + size_t slen, plen; + + slen = strlen(str); + plen = eina_strlen_bounded(prefix, slen); + if (plen == (size_t)-1) return EINA_FALSE; + + return (strncasecmp(str, prefix, plen) == 0); +} diff --git a/src/bin/utils.h b/src/bin/utils.h index 950cfaf..cac123b 100644 --- a/src/bin/utils.h +++ b/src/bin/utils.h @@ -12,6 +12,7 @@ Eina_Bool _util_link_is_email(const char *str); Eina_Bool _util_link_is_protocol(const char *str); Eina_Bool _util_is_file(const char *str); char *_util_local_path_get(const Evas_Object *obj, const char *relpath); +Eina_Bool _util_str_has_prefix(const char *str, const char *prefix); #if defined(SUPPORT_DBLWIDTH) static inline Eina_Bool