inline int ptr_len_casecmp(const char* p1, int l1, const char* p2, int l2) strcasecmp() functionality for two ptr length pairs
| 87 | // strcasecmp() functionality for two ptr length pairs |
| 88 | // |
| 89 | inline int |
| 90 | ptr_len_casecmp(const char *p1, int l1, const char *p2, int l2) |
| 91 | { |
| 92 | if (l1 < l2) { |
| 93 | return -1; |
| 94 | } else if (l1 > l2) { |
| 95 | return 1; |
| 96 | } |
| 97 | |
| 98 | while (l1) { |
| 99 | char p1c = ParseRules::ink_tolower(*p1); |
| 100 | char p2c = ParseRules::ink_tolower(*p2); |
| 101 | |
| 102 | if (p1c != p2c) { |
| 103 | if (p1c > p2c) { |
| 104 | return 1; |
| 105 | } else { |
| 106 | return -1; |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | p1++; |
| 111 | p2++; |
| 112 | l1--; |
| 113 | } |
| 114 | |
| 115 | return 0; |
| 116 | } |
| 117 | |
| 118 | // inline const char* ptr_len_str(const char* p1, int l1, const char* str) |
| 119 | // |
no outgoing calls
no test coverage detected