summaryrefslogtreecommitdiffstats
path: root/coccinelle
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2023-08-09 16:41:58 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2023-08-16 12:52:56 +0200
commit13d84288bc400eb07e02da375c6b6bbc4db45344 (patch)
treecec8cf11234215b0eb98f51e0cc0c53276fe12f2 /coccinelle
parentbasic/errno-util: add wrappers which only accept negative errno (diff)
downloadsystemd-13d84288bc400eb07e02da375c6b6bbc4db45344.tar.xz
systemd-13d84288bc400eb07e02da375c6b6bbc4db45344.zip
tree-wide: use cocinnelle to apply _NEG_ macros
Diffstat (limited to 'coccinelle')
-rw-r--r--coccinelle/errno-wrapper.cocci46
1 files changed, 46 insertions, 0 deletions
diff --git a/coccinelle/errno-wrapper.cocci b/coccinelle/errno-wrapper.cocci
new file mode 100644
index 0000000000..61c8782708
--- /dev/null
+++ b/coccinelle/errno-wrapper.cocci
@@ -0,0 +1,46 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+@@
+expression r;
+@@
+- (r < 0 && ERRNO_IS_TRANSIENT(r))
++ ERRNO_IS_NEG_TRANSIENT(r)
+@@
+expression r;
+@@
+- (r < 0 && ERRNO_IS_DISCONNECT(r))
++ ERRNO_IS_NEG_DISCONNECT(r)
+@@
+expression r;
+@@
+- (r < 0 && ERRNO_IS_ACCEPT_AGAIN(r))
++ ERRNO_IS_NEG_ACCEPT_AGAIN(r)
+@@
+expression r;
+@@
+- (r < 0 && ERRNO_IS_RESOURCE(r))
++ ERRNO_IS_NEG_RESOURCE(r)
+@@
+expression r;
+@@
+- (r < 0 && ERRNO_IS_NOT_SUPPORTED(r))
++ ERRNO_IS_NEG_NOT_SUPPORTED(r)
+@@
+expression r;
+@@
+- (r < 0 && ERRNO_IS_PRIVILEGE(r))
++ ERRNO_IS_NEG_PRIVILEGE(r)
+@@
+expression r;
+@@
+- (r < 0 && ERRNO_IS_DISK_SPACE(r))
++ ERRNO_IS_NEG_DISK_SPACE(r)
+@@
+expression r;
+@@
+- (r < 0 && ERRNO_IS_DEVICE_ABSENT(r))
++ ERRNO_IS_NEG_DEVICE_ABSENT(r)
+@@
+expression r;
+@@
+- (r < 0 && ERRNO_IS_XATTR_ABSENT(r))
++ ERRNO_IS_NEG_XATTR_ABSENT(r)