MCPcopy Create free account
hub / github.com/F-Stack/f-stack / mbufstrncmp

Function mbufstrncmp

freebsd/netinet/accf_http.c:121–143  ·  view source on GitHub ↗

* start at mbuf m, (must provide npkt if exists) * starting at offset in m compare characters in mbuf chain for 'cmp' * stop at 'max' characters */

Source from the content-addressed store, hash-verified

119 * stop at 'max' characters
120 */
121static int
122mbufstrncmp(struct mbuf *m, struct mbuf *npkt, int offset, int max, char *cmp)
123{
124 struct mbuf *n;
125
126 for (; m != NULL; m = n) {
127 n = npkt;
128 if (npkt)
129 npkt = npkt->m_nextpkt;
130 for (; m; m = m->m_next) {
131 for (; offset < m->m_len; offset++, cmp++, max--) {
132 if (max == 0 || *cmp == '\0')
133 return (1);
134 else if (*cmp != *(mtod(m, char *) + offset))
135 return (0);
136 }
137 if (max == 0 || *cmp == '\0')
138 return (1);
139 offset = 0;
140 }
141 }
142 return (0);
143}
144
145#define STRSETUP(sptr, slen, str) \
146 do { \

Callers 2

sohashttpgetFunction · 0.85
soparsehttpversFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected