1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 17:51:22 +03:00
Commit Graph

2 Commits

Author SHA1 Message Date
Frantisek Sumsal
60d9959dd8 coccinelle: ignore function transformations causing recursion
For example, following transformation:

- isempty(s) ? NULL : s
+ empty_to_null(s)

would get applied to the empty_to_null function itself as well,
causing an infinite recursion, like:

--- src/basic/string-util.h
+++ /tmp/cocci-output-307-9f76e6-string-util.h
@@ -50,11 +50,11 @@ static inline bool isempty(const char *p
 }

 static inline const char *empty_to_null(const char *p) {
-        return isempty(p) ? NULL : p;
+        return empty_to_null(p);
 }

Let's avoid that by checking the current match position
2019-04-29 15:38:53 +02:00
Lennart Poettering
a8ea93a5e2 core: use empty_to_null() where we can 2017-12-07 12:13:00 +01:00