| 52 | } |
| 53 | |
| 54 | int acl_strrncasecmp(const char *s1, const char *s2, size_t n) |
| 55 | { |
| 56 | if (n != 0) { |
| 57 | const unsigned char *cm = maptolower, *us1, *us2; |
| 58 | |
| 59 | if (*s1 == 0) { |
| 60 | if (*s2 == 0) |
| 61 | return (0); |
| 62 | return (-(*s2)); |
| 63 | } |
| 64 | if (*s2 == 0) { |
| 65 | if (*s1 == 0) |
| 66 | return (0); |
| 67 | return (-(*s1)); |
| 68 | } |
| 69 | |
| 70 | us1 = (const unsigned char *) s1 + strlen(s1) - 1; |
| 71 | us2 = (const unsigned char *) s2 + strlen(s2) - 1; |
| 72 | |
| 73 | do { |
| 74 | if (cm[*us1] != cm[*us2]) |
| 75 | return (cm[*us1] - cm[*us2]); |
| 76 | if (us1 == (const unsigned char*) s1) { |
| 77 | if (us2 == (const unsigned char*) s2 || n == 1) |
| 78 | break; |
| 79 | return (-cm[*--us2]); |
| 80 | } |
| 81 | if (us2 == (const unsigned char*) s2) { |
| 82 | if (us1 == (const unsigned char*) s1 || n == 1) |
| 83 | break; |
| 84 | return (-cm[*--us1]); |
| 85 | } |
| 86 | us1--; |
| 87 | us2--; |
| 88 | } while (--n != 0); |
| 89 | } |
| 90 | return (0); |
| 91 | } |
| 92 | |
| 93 | int acl_strrncmp(const char *s1, const char *s2, size_t n) |
| 94 | { |
no outgoing calls
no test coverage detected
searching dependent graphs…