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

Function pbufFindStr

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

Source from the content-addressed store, hash-verified

83}
84
85int pbufFindStr(const pbuf* buf, const char* wtf, unsigned startPos)
86{
87 if(wtf == nullptr) {
88 return -1;
89 }
90
91 int cur = startPos;
92 while(true) {
93 cur = pbufFindChar(buf, wtf[0], cur);
94 if(cur < 0) {
95 return -1;
96 }
97
98 if(pbufIsStrEqual(buf, wtf, cur)) {
99 return cur;
100 }
101 cur++;
102 }
103
104 return -1;
105}
106
107char* pbufAllocateStrCopy(const pbuf* buf, unsigned startPos, unsigned length)
108{

Callers 1

onReceiveMethod · 0.85

Calls 2

pbufFindCharFunction · 0.85
pbufIsStrEqualFunction · 0.85

Tested by

no test coverage detected