From: Tobias Brunner Date: Wed, 19 Jun 2013 10:24:40 +0000 (+0200) Subject: utils: Add helper function to check a string for a given prefix X-Git-Tag: 5.1.0dr2~2^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f460facdca9995e32d1c69f84945a306c6063a40;p=thirdparty%2Fstrongswan.git utils: Add helper function to check a string for a given prefix --- diff --git a/src/libstrongswan/utils/utils.h b/src/libstrongswan/utils/utils.h index 081852cd93..0e103de9cb 100644 --- a/src/libstrongswan/utils/utils.h +++ b/src/libstrongswan/utils/utils.h @@ -88,6 +88,14 @@ static inline bool strneq(const char *x, const char *y, size_t len) return strncmp(x, y, len) == 0; } +/** + * Helper function that checks if a string starts with a given prefix + */ +static inline bool strpfx(const char *x, const char *prefix) +{ + return strneq(x, prefix, strlen(prefix)); +} + /** * Helper function that compares two strings for equality ignoring case */