1234567891011121314
void *memmem(const void *p, const void *q, size_t pn, size_t qn) { //***** this for loop looks weird, can you explain it please ******// for(; pn >= qn; p = (const unsigned char *)p + 1, --pn) if(memcmp(p, q, qn) == 0) return p; return NULL; } void *p; if((p = memmem(memblock, IpAddrOld, size, sizeof IpAddrOld)) != NULL) memcpy(p, IpAddrNew, sizeof IpAddrNew);
for(; pn >= qn; p = (const unsigned char *)p + 1, --pn)
pn >= qn;
p = (const unsigned char *)p + 1, --pn