diff options
author | Tobias Brunner <tobias@strongswan.org> | 2013-06-19 12:22:29 +0200 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2013-07-08 18:49:29 +0200 |
commit | 985dcab1c2a0192eada1105cdd1edc665b0fb099 (patch) | |
tree | 5bb9fd4c322d19d1eef20565bd268e3c661867da /src | |
parent | 2ecda3421a263cea708cc94c2a9e5902aa960974 (diff) | |
download | strongswan-985dcab1c2a0192eada1105cdd1edc665b0fb099.tar.bz2 strongswan-985dcab1c2a0192eada1105cdd1edc665b0fb099.tar.xz |
utils: Convert string helper macros to static inline functions
Diffstat (limited to 'src')
-rw-r--r-- | src/libstrongswan/utils/utils.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/libstrongswan/utils/utils.h b/src/libstrongswan/utils/utils.h index 06282de55..081852cd9 100644 --- a/src/libstrongswan/utils/utils.h +++ b/src/libstrongswan/utils/utils.h @@ -81,9 +81,12 @@ static inline bool streq(const char *x, const char *y) } /** - * Macro compares two strings for equality, length limited + * Helper function that compares two strings for equality, length limited */ -#define strneq(x,y,len) (strncmp(x, y, len) == 0) +static inline bool strneq(const char *x, const char *y, size_t len) +{ + return strncmp(x, y, len) == 0; +} /** * Helper function that compares two strings for equality ignoring case @@ -94,9 +97,12 @@ static inline bool strcaseeq(const char *x, const char *y) } /** - * Macro compares two strings for equality ignoring case, length limited + * Helper function that compares two strings for equality ignoring case, length limited */ -#define strncaseeq(x,y,len) (strncasecmp(x, y, len) == 0) +static inline bool strncaseeq(const char *x, const char *y, size_t len) +{ + return strncasecmp(x, y, len) == 0; +} /** * NULL-safe strdup variant @@ -107,9 +113,12 @@ static inline char *strdupnull(const char *s) } /** - * Macro compares two binary blobs for equality + * Helper function that compares two binary blobs for equality */ -#define memeq(x,y,len) (memcmp(x, y, len) == 0) +static inline bool memeq(const void *x, const void *y, size_t len) +{ + return memcmp(x, y, len) == 0; +} /** * Macro gives back larger of two values. |