Commit d071aa5
committed
Merge #1815: refactor: remove unnecessary
97b3c47 refactor: remove unnecessary `malloc` result casts (Sebastian Falbesoner)
Pull request description:
While working on benchmark code for #1765, I noticed that in some instances we explicitly cast `malloc` results in the codebase. It seems that there is no good reason to do this in C, and it's even considered bad practice, see e.g. https://stackoverflow.com/a/605858.
This commit touches mostly test code, the only two functions used in production are `secp256k1_context_{create,clone}`. Instances were found manually via `$ git grep "malloc("`.
ACKs for top commit:
real-or-random:
Weak Concept ACK && Code Review ACK 97b3c47
w0xlt:
ACK 97b3c47
Tree-SHA512: 74aa9f47eb52b7f2a6fcb69deb6aef0c0daa136c5deedfba1228218ef178c722212d8e9936fd2946d2035df932637ca4df49c98ddde488c6b009a74c4d5df316malloc result casts3 files changed
+17
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
171 | | - | |
| 171 | + | |
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3676 | 3676 | | |
3677 | 3677 | | |
3678 | 3678 | | |
3679 | | - | |
3680 | | - | |
| 3679 | + | |
| 3680 | + | |
3681 | 3681 | | |
3682 | 3682 | | |
3683 | 3683 | | |
| |||
3811 | 3811 | | |
3812 | 3812 | | |
3813 | 3813 | | |
3814 | | - | |
| 3814 | + | |
3815 | 3815 | | |
3816 | 3816 | | |
3817 | 3817 | | |
| |||
3832 | 3832 | | |
3833 | 3833 | | |
3834 | 3834 | | |
3835 | | - | |
3836 | | - | |
| 3835 | + | |
| 3836 | + | |
3837 | 3837 | | |
3838 | 3838 | | |
3839 | 3839 | | |
| |||
5175 | 5175 | | |
5176 | 5176 | | |
5177 | 5177 | | |
5178 | | - | |
5179 | | - | |
| 5178 | + | |
| 5179 | + | |
5180 | 5180 | | |
5181 | 5181 | | |
5182 | 5182 | | |
| |||
0 commit comments