From: Lennart Poettering Date: Thu, 17 Jun 2021 09:04:31 +0000 (+0200) Subject: path-util: make path_equal() an inline wrapper around path_compare() X-Git-Tag: v249-rc2~41 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1a27c323dd21341875d62c5b13a878859d094318;p=thirdparty%2Fsystemd.git path-util: make path_equal() an inline wrapper around path_compare() The two are completely identical, only the return code is inverted. let's hence make it easy for the compiler to make it the same function call even in lowest optimization modes. --- diff --git a/src/basic/path-util.c b/src/basic/path-util.c index eb547e74672..e5afb5f5f5e 100644 --- a/src/basic/path-util.c +++ b/src/basic/path-util.c @@ -514,10 +514,6 @@ int path_compare(const char *a, const char *b) { } } -bool path_equal(const char *a, const char *b) { - return path_compare(a, b) == 0; -} - bool path_equal_or_files_same(const char *a, const char *b, int flags) { return path_equal(a, b) || files_same(a, b, flags) > 0; } diff --git a/src/basic/path-util.h b/src/basic/path-util.h index c6d4668794b..26e7362d1f5 100644 --- a/src/basic/path-util.h +++ b/src/basic/path-util.h @@ -62,7 +62,11 @@ static inline char* path_startswith(const char *path, const char *prefix) { return path_startswith_full(path, prefix, true); } int path_compare(const char *a, const char *b) _pure_; -bool path_equal(const char *a, const char *b) _pure_; + +static inline bool path_equal(const char *a, const char *b) { + return path_compare(a, b) == 0; +} + bool path_equal_or_files_same(const char *a, const char *b, int flags); /* Compares only the last portion of the input paths, ie: the filenames */ bool path_equal_filename(const char *a, const char *b);