aboutsummaryrefslogtreecommitdiff
path: root/string
diff options
context:
space:
mode:
authorDavid <dbphillipsnz@gmail.com>2013-11-30 09:14:45 +1300
committerDavid <dbphillipsnz@gmail.com>2014-03-27 20:32:48 +1300
commit5d944dfe9f03c9fb43271199d2ba4b8880747614 (patch)
treeab57a964538f06e86064ad45cb510673b91b8c94 /string
parentf5bbf7cf9bd1eff316fd5b2d2ed71abbb49a7ecd (diff)
downloadtoast-5d944dfe9f03c9fb43271199d2ba4b8880747614.tar.xz
Bugfixes in strlen() which used to handle zero-length strings incorrectly
Diffstat (limited to 'string')
-rw-r--r--string/common.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/string/common.c b/string/common.c
index 6edce1a..b9adc3e 100644
--- a/string/common.c
+++ b/string/common.c
@@ -24,8 +24,8 @@
uint64_t strlen(const char *string)
{
uint64_t l = 0;
- while (string[++l] != 0);
- return l;
+ while (string[l++]);
+ return l-1;
}
bool itoa(uint32_t num, char *buffer, uint8_t base)