]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
basic/path-util: inline two trivial functions
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 17 Sep 2020 12:12:05 +0000 (14:12 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 18 Sep 2020 13:28:48 +0000 (15:28 +0200)
While at it, add assert() for the argument.

src/basic/path-util.c
src/basic/path-util.h

index d24b82268fdb83991a512a1f44f57b2a9079cc5c..cecee3a5415901251292fdbc04cec4e89c052aba 100644 (file)
 #include "time-util.h"
 #include "utf8.h"
 
-bool path_is_absolute(const char *p) {
-        return p[0] == '/';
-}
-
-bool is_path(const char *p) {
-        return !!strchr(p, '/');
-}
-
 int path_split_and_make_absolute(const char *p, char ***ret) {
         char **l;
         int r;
index 93e0f82bdc62b6204f85ee014d6f0d13015d8115..3d5244833437b2e25d74fe485c95989abdebb699 100644 (file)
 #  define DEFAULT_USER_PATH DEFAULT_PATH
 #endif
 
-bool is_path(const char *p) _pure_;
+static inline bool is_path(const char *p) {
+        assert(p);
+        return strchr(p, '/');
+}
+
+static inline bool path_is_absolute(const char *p) {
+        assert(p);
+        return p[0] == '/';
+}
+
 int path_split_and_make_absolute(const char *p, char ***ret);
-bool path_is_absolute(const char *p) _pure_;
 char* path_make_absolute(const char *p, const char *prefix);
 int safe_getcwd(char **ret);
 int path_make_absolute_cwd(const char *p, char **ret);