| 91 | } |
| 92 | |
| 93 | int acl_strrncmp(const char *s1, const char *s2, size_t n) |
| 94 | { |
| 95 | if (n != 0) { |
| 96 | const unsigned char *us1, *us2; |
| 97 | |
| 98 | if (*s1 == 0) { |
| 99 | if (*s2 == 0) |
| 100 | return (0); |
| 101 | return (-(*s2)); |
| 102 | } |
| 103 | if (*s2 == 0) { |
| 104 | if (*s1 == 0) |
| 105 | return (0); |
| 106 | return (-(*s1)); |
| 107 | } |
| 108 | |
| 109 | us1 = (const unsigned char *) s1 + strlen(s1) - 1; |
| 110 | us2 = (const unsigned char *) s2 + strlen(s2) - 1; |
| 111 | |
| 112 | do { |
| 113 | if (*us1 != *us2) |
| 114 | return (*us1 - *us2); |
| 115 | if (us1 == (const unsigned char*) s1) { |
| 116 | if (us2 == (const unsigned char*) s2 || n == 1) |
| 117 | break; |
| 118 | return (-(*--us2)); |
| 119 | } |
| 120 | if (us2 == (const unsigned char*) s2) { |
| 121 | if (us1 == (const unsigned char*) s1 || n == 1) |
| 122 | break; |
| 123 | return (-(*--us1)); |
| 124 | } |
| 125 | us1--; |
| 126 | us2--; |
| 127 | } while (--n != 0); |
| 128 | } |
| 129 | return (0); |
| 130 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…