tree-wide: introduce free_and_replace helper
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 16 Oct 2016 23:23:35 +0000 (19:23 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 17 Oct 2016 03:35:39 +0000 (23:35 -0400)
commit3b319885c4febb5f7ea9b5ab31c3395548ed6886
treea342cd060e144ed447ecd43b22a7b87068070170
parent6b430fdb7c0c2c52ea69a7d56f23d739218b13d0
tree-wide: introduce free_and_replace helper

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.
coccinelle/free_and_replace.cocci [new file with mode: 0644]
src/basic/alloc-util.h
src/basic/fs-util.c
src/basic/path-util.c
src/core/load-fragment.c
src/core/mount.c
src/core/service.c
src/journal-remote/journal-upload.c
src/shared/install.c