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

Function rn_satisfies_leaf

freebsd/net/radix.c:252–268  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250}
251
252static int
253rn_satisfies_leaf(char *trial, struct radix_node *leaf, int skip)
254{
255 char *cp = trial, *cp2 = leaf->rn_key, *cp3 = leaf->rn_mask;
256 char *cplim;
257 int length = min(LEN(cp), LEN(cp2));
258
259 if (cp3 == NULL)
260 cp3 = rn_ones;
261 else
262 length = min(length, LEN(cp3));
263 cplim = cp + length; cp3 += skip; cp2 += skip;
264 for (cp += skip; cp < cplim; cp++, cp2++, cp3++)
265 if ((*cp ^ *cp2) & *cp3)
266 return (0);
267 return (1);
268}
269
270/*
271 * Search for longest-prefix match in given @head

Callers 1

rn_matchFunction · 0.85

Calls 1

minFunction · 0.85

Tested by

no test coverage detected