MCPcopy Create free account
hub / github.com/acl-dev/acl / acl_vstring_memcat

Function acl_vstring_memcat

lib_acl/src/stdlib/acl_vstring.c:585–618  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

583/* acl_vstring_memcat - append buffer of limited length */
584
585ACL_VSTRING *acl_vstring_memcat(ACL_VSTRING *vp, const char *src, size_t len)
586{
587 if (len > 0) {
588 ssize_t n;
589
590 if (len >= 100000000) {
591 acl_msg_warn("%s(%d): len=%ld maybe too large",
592 __FUNCTION__, __LINE__, (long) len);
593 }
594
595 ACL_VSTRING_SPACE(vp, (ssize_t) len);
596 n = acl_vstring_avail(vp);
597
598 if ((size_t) n >= len) {
599 n = (ssize_t) len;
600 } else {
601 acl_msg_warn("%s(%d): space not enough, avail: %ld, "
602 "len: %ld", __FUNCTION__, __LINE__,
603 (long) n, (long) len);
604 }
605
606 if (n > 0 ) {
607 memcpy(acl_vstring_end(vp), src, n);
608 n += (ssize_t) ACL_VSTRING_LEN(vp);
609 ACL_VSTRING_AT_OFFSET(vp, n);
610 } else {
611 acl_msg_warn("%s(%d): no space, avail: 0, len: %ld",
612 __FUNCTION__, __LINE__, (long) len);
613 }
614 }
615
616 ACL_VSTRING_TERMINATE(vp);
617 return vp;
618}
619
620/* acl_vstring_memchr - locate byte in buffer */
621

Callers 15

get_body_from_reqFunction · 0.85
read_request_body_readyFunction · 0.85
bfread_cntFunction · 0.85
bfreadFunction · 0.85
acl_vstream_loadfile2Function · 0.85
acl_chain_addFunction · 0.85
acl_vstream_popenFunction · 0.85
acl_vstring_strcatFunction · 0.85
acl_vstring_strncatFunction · 0.85
acl_buffer_gets_nonlFunction · 0.85
acl_buffer_getsFunction · 0.85

Calls 2

acl_msg_warnFunction · 0.85
memcpyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…