MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / l_memmem

Function l_memmem

ut.h:1560–1585  ·  view source on GitHub ↗

* l_memmem() returns the location of the first occurrence of data * pattern b2 of size len2 in memory block b1 of size len1 or * NULL if none is found. Obtained from NetBSD. */

Source from the content-addressed store, hash-verified

1558 * NULL if none is found. Obtained from NetBSD.
1559 */
1560static inline void * l_memmem(const void *b1, const void *b2,
1561 size_t len1, size_t len2)
1562{
1563 /* Initialize search pointer */
1564 char *sp = (char *) b1;
1565
1566 /* Initialize pattern pointer */
1567 char *pp = (char *) b2;
1568
1569 /* Initialize end of search address space pointer */
1570 char *eos = sp + len1 - len2;
1571
1572 /* Sanity check */
1573 if(!(b1 && b2 && len1 && len2))
1574 return NULL;
1575
1576 while (sp <= eos) {
1577 if (*sp == *pp)
1578 if (memcmp(sp, pp, len2) == 0)
1579 return sp;
1580
1581 sp++;
1582 }
1583
1584 return NULL;
1585}
1586
1587/**
1588 * Make any database URL log-friendly by masking its password, if any

Callers 12

get_deps_wmode_presetFunction · 0.85
init_iam_defaultFunction · 0.85
get_cause_from_reasonFunction · 0.85
extract_mediainfoFunction · 0.85
rtpproxy_offer_answerFunction · 0.85
find_line_delimiterFunction · 0.85
extract_rtpmapFunction · 0.85
extract_bwidthFunction · 0.85
extract_mediaipFunction · 0.85
extract_media_attrFunction · 0.85
find_sdp_lineFunction · 0.85
find_sdp_line_complexFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected