diff options
author | Tobias Brunner <tobias@strongswan.org> | 2013-06-19 12:24:40 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2013-07-08 18:49:30 +0200 |
commit | f460facdca9995e32d1c69f84945a306c6063a40 (patch) | |
tree | 4e04be20fa98d3364a1019dda1a8aa4b78520cea /src/libstrongswan/utils/utils.h | |
parent | 985dcab1c2a0192eada1105cdd1edc665b0fb099 (diff) | |
download | strongswan-f460facdca9995e32d1c69f84945a306c6063a40.tar.bz2 strongswan-f460facdca9995e32d1c69f84945a306c6063a40.tar.xz |
utils: Add helper function to check a string for a given prefix
Diffstat (limited to 'src/libstrongswan/utils/utils.h')
-rw-r--r-- | src/libstrongswan/utils/utils.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libstrongswan/utils/utils.h b/src/libstrongswan/utils/utils.h index 081852cd9..0e103de9c 100644 --- a/src/libstrongswan/utils/utils.h +++ b/src/libstrongswan/utils/utils.h @@ -89,6 +89,14 @@ static inline bool strneq(const char *x, const char *y, size_t len) } /** + * 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 */ static inline bool strcaseeq(const char *x, const char *y) |