Commit Graph

4 Commits

Author SHA1 Message Date
Frantisek Sumsal e4ff03935c tree-wide: formatting tweaks reported by Coccinelle 2020-04-21 23:21:04 +02:00
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 ad5d4b1703 cocci: use strempty() at more places
This shortens the code by a few lines.
2018-01-10 17:11:19 +01:00
Daniel Mack de896126ea Add Coccinelle patch for strempty() usage 2015-09-30 12:24:16 +02:00