Commit ae2a15b
committed
macro: introduce TAKE_PTR() macro
This macro will read a pointer of any type, return it, and set the
pointer to NULL. This is useful as an explicit concept of passing
ownership of a memory area between pointers.
This takes inspiration from Rust:
https://doc.rust-lang.org/std/option/enum.Option.html#method.take
and was suggested by Alan Jenkins (@sourcejedi).
It drops ~160 lines of code from our codebase, which makes me like it.
Also, I think it clarifies passing of ownership, and thus helps
readability a bit (at least for the initiated who know the new macro)1 parent 1147eef commit ae2a15b
File tree
93 files changed
+215
-379
lines changed- coccinelle
- src
- basic
- busctl
- coredump
- core
- cryptsetup
- environment-d-generator
- firstboot
- import
- journal
- libsystemd-network
- libsystemd
- sd-bus
- sd-daemon
- sd-device
- sd-login
- sd-netlink
- sd-network
- libudev
- locale
- login
- machine
- mount
- network
- netdev
- nspawn
- resolve
- systemctl
- sysv-generator
- tmpfiles
- udev
- net
- vconsole
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
93 files changed
+215
-379
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | | - | |
| 106 | + | |
108 | 107 | | |
109 | 108 | | |
110 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1424 | 1424 | | |
1425 | 1425 | | |
1426 | 1426 | | |
1427 | | - | |
1428 | | - | |
1429 | | - | |
1430 | | - | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
1431 | 1430 | | |
1432 | 1431 | | |
1433 | 1432 | | |
| |||
2010 | 2009 | | |
2011 | 2010 | | |
2012 | 2011 | | |
2013 | | - | |
2014 | | - | |
| 2012 | + | |
2015 | 2013 | | |
2016 | 2014 | | |
2017 | 2015 | | |
| |||
2301 | 2299 | | |
2302 | 2300 | | |
2303 | 2301 | | |
2304 | | - | |
2305 | | - | |
| 2302 | + | |
2306 | 2303 | | |
2307 | 2304 | | |
2308 | 2305 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
198 | | - | |
| 197 | + | |
199 | 198 | | |
200 | 199 | | |
201 | 200 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
333 | | - | |
334 | | - | |
| 333 | + | |
335 | 334 | | |
336 | 335 | | |
337 | 336 | | |
| |||
1432 | 1431 | | |
1433 | 1432 | | |
1434 | 1433 | | |
1435 | | - | |
1436 | | - | |
| 1434 | + | |
1437 | 1435 | | |
1438 | 1436 | | |
1439 | 1437 | | |
| |||
1519 | 1517 | | |
1520 | 1518 | | |
1521 | 1519 | | |
1522 | | - | |
1523 | | - | |
| 1520 | + | |
1524 | 1521 | | |
1525 | 1522 | | |
1526 | 1523 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
| 461 | + | |
| 462 | + | |
465 | 463 | | |
466 | 464 | | |
467 | 465 | | |
| |||
838 | 836 | | |
839 | 837 | | |
840 | 838 | | |
841 | | - | |
842 | | - | |
843 | | - | |
844 | | - | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
845 | 842 | | |
846 | 843 | | |
847 | 844 | | |
| |||
863 | 860 | | |
864 | 861 | | |
865 | 862 | | |
866 | | - | |
867 | | - | |
868 | | - | |
869 | | - | |
| 863 | + | |
| 864 | + | |
870 | 865 | | |
871 | 866 | | |
872 | 867 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
344 | | - | |
345 | | - | |
| 344 | + | |
346 | 345 | | |
347 | 346 | | |
348 | 347 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
| 84 | + | |
| 85 | + | |
88 | 86 | | |
89 | 87 | | |
90 | 88 | | |
| |||
951 | 949 | | |
952 | 950 | | |
953 | 951 | | |
954 | | - | |
955 | | - | |
| 952 | + | |
956 | 953 | | |
957 | 954 | | |
958 | 955 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
327 | | - | |
328 | | - | |
| 327 | + | |
329 | 328 | | |
330 | 329 | | |
331 | 330 | | |
| |||
0 commit comments