MCPcopy Create free account
hub / github.com/acl-dev/acl / acl_strrncmp

Function acl_strrncmp

lib_acl/src/stdlib/string/acl_strcasecmp.c:93–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93int 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}

Callers 4

rncompareMethod · 0.85
http_access_permitFunction · 0.85
http_redirect_lookupFunction · 0.85
http_request_forwardFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…