diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-09-09 15:20:10 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-09-09 15:26:11 +0200 |
commit | 74ca738f6a01fb5fc19c5c3899f5cb1fdc1d7f68 (patch) | |
tree | 920d0abca454976756296d982d1cb9ef794e1ade /coccinelle | |
parent | 9c00a6adfa6c2ded071222b2ec76295480add34e (diff) | |
download | systemd-74ca738f6a01fb5fc19c5c3899f5cb1fdc1d7f68.tar.gz |
util: introduce safe_fclose() and port everything over to it
Adds a coccinelle script to port things over automatically.
Diffstat (limited to 'coccinelle')
-rw-r--r-- | coccinelle/safe_fclose.cocci | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/coccinelle/safe_fclose.cocci b/coccinelle/safe_fclose.cocci new file mode 100644 index 0000000000..6961cd0164 --- /dev/null +++ b/coccinelle/safe_fclose.cocci @@ -0,0 +1,27 @@ +@@ +expression p; +@@ +- if (p) { +- fclose(p); +- p = NULL; +- } ++ p = safe_fclose(p); +@@ +expression p; +@@ +- if (p) +- fclose(p); +- p = NULL; ++ p = safe_fclose(p); +@@ +expression p; +@@ +- fclose(p); +- p = NULL; ++ p = safe_fclose(p); +@@ +expression p; +@@ +- if (p) +- fclose(p); ++ safe_fclose(p); |