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

Function acl_buffer_gets_nonl

lib_acl/src/stdlib/acl_vstring.c:967–1003  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

965}
966
967const ACL_VSTRING *acl_buffer_gets_nonl(ACL_VSTRING *vp, const char **src, size_t dlen)
968{
969 const char *myname = "acl_buffer_gets_nonl";
970 const char *ptr, *pend, *pbegin = *src;
971
972 if (dlen <= 0) {
973 acl_msg_warn("%s(%d): dlen(%d) invalid",
974 myname, __LINE__, (int) dlen);
975 return NULL;
976 }
977
978 ptr = memchr(pbegin, '\n', dlen);
979 if (ptr == NULL) {
980 acl_vstring_memcat(vp, pbegin, dlen);
981 ACL_VSTRING_TERMINATE(vp);
982 *src += dlen; /* �ƶ� *src ָ��λ�� */
983 return NULL;
984 }
985 *src = ptr + 1; /* �ƶ� *src ָ��λ�� */
986 pend = ptr;
987
988 /* ȥ������� \r\n */
989 while (pend >= pbegin) {
990 if (*pend != '\r' && *pend != '\n') {
991 break;
992 }
993 pend--;
994 }
995 if (pend < pbegin) {
996 /* ˵�� data ��ֻ���� \r, \n */
997 ACL_VSTRING_TERMINATE(vp);
998 return vp;
999 }
1000 acl_vstring_memcat(vp, pbegin, pend - pbegin + 1);
1001 ACL_VSTRING_TERMINATE(vp);
1002 return vp;
1003}
1004
1005const ACL_VSTRING *acl_buffer_gets(ACL_VSTRING *vp, const char **src, size_t dlen)
1006{

Callers 2

test_buffer_getsFunction · 0.85
mainFunction · 0.85

Calls 2

acl_msg_warnFunction · 0.85
acl_vstring_memcatFunction · 0.85

Tested by 1

test_buffer_getsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…