aboutsummaryrefslogtreecommitdiff
path: root/strings.c
diff options
context:
space:
mode:
Diffstat (limited to 'strings.c')
-rw-r--r--strings.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/strings.c b/strings.c
index 34c269a..fb3b0ac 100644
--- a/strings.c
+++ b/strings.c
@@ -47,12 +47,12 @@ void uint32_to_binstring(uint32_t number, char buf[33])
void trim_0s(char string[])
{
size_t i;
- for (i = 0; string[i] != '\0' && string[i] != '0'; i++);
-
+ for (i = 0; string[i] == '0'; i++);
+
size_t j = 0;
- if (string[i] == '\0')
- string[j++] = string[i--];
+ if (!string[i])
+ string[j++] = string[--i];
do
string[j] = string[i + j];