systemd/coccinelle/hashmap_free.cocci
Lennart Poettering 525d3cc746 tree-wide: take benefit of the fact that hashmap_free() returns NULL
And set_free() too.

Another Coccinelle patch.
2015-09-09 23:12:07 +02:00

55 lines
658 B
Plaintext

@@
expression p;
@@
- set_free(p);
- p = NULL;
+ p = set_free(p);
@@
expression p;
@@
- if (p)
- set_free(p);
- p = NULL;
+ p = set_free(p);
@@
expression p;
@@
- if (p) {
- set_free(p);
- p = NULL;
- }
+ p = set_free(p);
@@
expression p;
@@
- if (p)
- set_free(p);
+ set_free(p);
@@
expression p;
@@
- hashmap_free(p);
- p = NULL;
+ p = hashmap_free(p);
@@
expression p;
@@
- if (p)
- hashmap_free(p);
- p = NULL;
+ p = hashmap_free(p);
@@
expression p;
@@
- if (p) {
- hashmap_free(p);
- p = NULL;
- }
+ p = hashmap_free(p);
@@
expression p;
@@
- if (p)
- hashmap_free(p);
+ hashmap_free(p);