systemd/coccinelle/safe_fclose.cocci
Lennart Poettering 74ca738f6a util: introduce safe_fclose() and port everything over to it
Adds a coccinelle script to port things over automatically.
2015-09-09 15:26:11 +02:00

28 lines
317 B
Plaintext

@@
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);