]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
errno-util: rework ERRNO_IS_RESOURCE() from macro into static inline function
authorLennart Poettering <lennart@poettering.net>
Wed, 10 Apr 2019 17:39:12 +0000 (19:39 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 10 Apr 2019 18:03:38 +0000 (20:03 +0200)
No technical reason, except that later on we want to add a new
ERRNO_IS() which uses the parameter twice and where we want to avoid
double evaluation, and where we'd like to keep things in the same style.

src/basic/errno-util.h

index f2677c7c19caaf6f284865fdf0258e62acef1572..ebb204128ed54bc286190f4460bb3051cfef92c6 100644 (file)
@@ -51,5 +51,9 @@ static inline bool ERRNO_IS_DISCONNECT(int r) {
 }
 
 /* Resource exhaustion, could be our fault or general system trouble */
-#define ERRNO_IS_RESOURCE(r) \
-        IN_SET(abs(r), ENOMEM, EMFILE, ENFILE)
+static inline bool ERRNO_IS_RESOURCE(int r) {
+        return IN_SET(abs(r),
+                      EMFILE,
+                      ENFILE,
+                      ENOMEM);
+}