diff --git a/include/common/ist.h b/include/common/ist.h index bd98ab008..7c60c68f3 100644 --- a/include/common/ist.h +++ b/include/common/ist.h @@ -28,6 +28,7 @@ #ifndef _COMMON_IST_H #define _COMMON_IST_H +#include #include #include @@ -243,6 +244,24 @@ static inline int isteq(const struct ist ist1, const struct ist ist2) return 1; } +/* returns non-zero if equals , ignoring the case (empty strings are equal) */ +static inline int isteqi(const struct ist ist1, const struct ist ist2) +{ + struct ist l = ist1; + struct ist r = ist2; + + if (l.len != r.len) + return 0; + + while (l.len--) { + if (tolower(*l.ptr) != tolower(*r.ptr)) + return 0; + l.ptr++; + r.ptr++; + } + return 1; +} + /* returns non-zero if equals on the first characters * (empty strings are equal). */