Skip to content

Commit e61b519

Browse files
committed
Simplify boolean checks and remove redundant conditions
1 parent 498da37 commit e61b519

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

lib/c.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ void __str_base10(char *pb, int val)
204204
i--;
205205
}
206206

207-
if (neg == 1)
207+
if (neg)
208208
pb[i] = '-';
209209
}
210210

@@ -692,7 +692,7 @@ void *calloc(int n, int size)
692692
/* Check for overflow before multiplication */
693693
if (!n || !size)
694694
return NULL;
695-
if (size != 0 && n > INT_MAX / size)
695+
if (n > INT_MAX / size)
696696
return NULL; /* Overflow protection */
697697

698698
int total = n * size;

tests/snapshots/fib-arm.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

tests/snapshots/fib-riscv.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

tests/snapshots/hello-arm.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

tests/snapshots/hello-riscv.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)