Skip to content

Strings without null-termination #97

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jan 25, 2021
Prev Previous commit
Next Next commit
Simplify String::concat(char)
Now concat(const char*, unsigned int) no longer requires a
nul-terminated string, we can simplify the concat(char) method to just
pass the address of the single character instead of having to create
buffer with nul-termination.
  • Loading branch information
matthijskooijman committed Jan 25, 2021
commit 81a2d51b212c1ea8594065b34de1abd711cdcc42
5 changes: 1 addition & 4 deletions api/String.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,7 @@ unsigned char String::concat(const char *cstr)

unsigned char String::concat(char c)
{
char buf[2];
buf[0] = c;
buf[1] = 0;
return concat(buf, 1);
return concat(&c, 1);
}

unsigned char String::concat(unsigned char num)
Expand Down