JosiahWI commented on code in PR #11456: URL: https://github.com/apache/trafficserver/pull/11456#discussion_r1673839733
########## src/iocore/cache/P_CacheDoc.h: ########## @@ -96,3 +104,58 @@ Doc::data() { return this->hdr() + this->hlen; } + +static char * +iobufferblock_memcpy(char *p, int len, IOBufferBlock const *ab, int offset) +{ + IOBufferBlock const *b = ab; + while (b && len >= 0) { + char *start = b->_start; + char *end = b->_end; + int max_bytes = end - start; + max_bytes -= offset; + if (max_bytes <= 0) { + offset = -max_bytes; + b = b->next.get(); + continue; + } + int bytes = len; + if (bytes >= max_bytes) { + bytes = max_bytes; + } + ::memcpy(p, start + offset, bytes); + p += bytes; + len -= bytes; + b = b->next.get(); + offset = 0; + } + return p; +} + +inline void Review Comment: Thank you for this suggestion. I will do this. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@trafficserver.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org