mirror of
https://github.com/systemd/systemd
synced 2024-09-06 16:56:43 +00:00
![Zbigniew Jędrzejewski-Szmek](/assets/img/avatar_default.png)
It's a common pattern, so add a helper for it. A macro is necessary because a function that takes a pointer to a pointer would be type specific, similarly to cleanup functions. Seems better to use a macro.
16 lines
181 B
Plaintext
16 lines
181 B
Plaintext
@@
|
|
expression p, q;
|
|
@@
|
|
- free(p);
|
|
- p = q;
|
|
- q = NULL;
|
|
- return 0;
|
|
+ return free_and_replace(p, q);
|
|
@@
|
|
expression p, q;
|
|
@@
|
|
- free(p);
|
|
- p = q;
|
|
- q = NULL;
|
|
+ free_and_replace(p, q);
|