MCPcopy Create free account
hub / github.com/SmingHub/Sming / pbufIsStrEqual

Function pbufIsStrEqual

Sming/Components/Network/src/Network/NetUtils.cpp:55–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55bool pbufIsStrEqual(const pbuf* buf, const char* compared, unsigned startPos)
56{
57 unsigned cur = startPos;
58
59 while(buf->len <= cur) {
60 cur -= buf->len;
61 buf = buf->next;
62 if(buf == nullptr) {
63 return false;
64 }
65 }
66
67 for(const char* cmp = compared; *cmp; cmp++) {
68 if(buf == nullptr)
69 return false;
70
71 char& target = ((char*)buf->payload)[cur];
72 if(target != *cmp)
73 return false;
74
75 cur++;
76 if(cur >= buf->len) {
77 cur = 0;
78 buf = buf->next;
79 }
80 }
81
82 return true;
83}
84
85int pbufFindStr(const pbuf* buf, const char* wtf, unsigned startPos)
86{

Callers 1

pbufFindStrFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected