X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=GrowingBuffer.cpp;h=8e3bd4a8472207391893c4b1f873b28a1352e0e7;hb=1d09585d4cd534462159bb3df84fdc63337d90ca;hp=a260a3dd1638cc21c740acc1a87a202e58a2358b;hpb=46f6c3d3ed2e03261fa726806dde9dcc605c0140;p=ecparse.git diff --git a/GrowingBuffer.cpp b/GrowingBuffer.cpp index a260a3d..8e3bd4a 100644 --- a/GrowingBuffer.cpp +++ b/GrowingBuffer.cpp @@ -98,3 +98,13 @@ void GrowingBuffer::resize(double factor) { } } +size_t GrowingBuffer::indexOf(char c, size_t start) { + void* foundIndex; + + foundIndex = memchr((ptrdiff_t*) data + position + start, c, (limit - start)); + if (foundIndex) { + return (ptrdiff_t) foundIndex - ((ptrdiff_t) data + position); + } + return -1; +} +