-
Notifications
You must be signed in to change notification settings - Fork 21
Commit 3181bc7
Always use calloc instead of malloc + memset
In most cases, they will be the same. In some cases, calloc() will do less
work because it can skip memset() entirely. In other cases, calloc() can even
cheat and not allocate any memory on modern operating systems. However, the
use of malloc() + memset() will always do the full amount of work.1 parent 9a582b8 commit 3181bc7
1 file changed
+2
-4
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4 | 4 |
| |
5 | 5 |
| |
6 | 6 |
| |
7 | - | ||
8 | - | ||
9 | - | ||
7 | + | ||
10 | 8 |
| |
11 | 9 |
| |
12 | 10 |
| |
| |||
111 | 109 |
| |
112 | 110 |
| |
113 | 111 |
| |
114 | - | ||
112 | + |
0 commit comments