String.reserve documentation
sterretjeToo opened this issue · 1 comments
sterretjeToo commented
The documentation for the reserve() method states that it does return "nothing". However, the method returns 0 (fail) or 1 (success).
`unsigned char String::reserve(unsigned int size)
{
if (buffer && capacity >= size) return 1;
if (changeBuffer(size)) {
if (len == 0) buffer[0] = 0;
return 1;
}
return 0;
}
unsigned char String::changeBuffer(unsigned int maxStrLen)
{
char *newbuffer = (char *)realloc(buffer, maxStrLen + 1);
if (newbuffer) {
buffer = newbuffer;
capacity = maxStrLen;
return 1;
}
return 0;
}`
karlsoderby commented
Hi there @sterretjeToo , this has been updated in #939
Thanks for the submission!