systemd/coccinelle/empty-to-null.cocci

14 lines
393 B
Plaintext
Raw Normal View History

/* SPDX-License-Identifier: LGPL-2.1-or-later */
2017-12-07 11:13:00 +00:00
@@
/* Avoid running this transformation on the empty_to_null macro itself.
* See the note in strempty.cocci to understand the weird magic below.
*/
position p : script:python() {
not (p[0].file == "src/basic/string-util.h" and p[0].current_element == "something_else")
};
2017-12-07 11:13:00 +00:00
expression s;
@@
- isempty@p(s) ? NULL : s
2017-12-07 11:13:00 +00:00
+ empty_to_null(s)