mirror of
https://github.com/systemd/systemd.git
synced 2025-02-23 13:57:33 +03:00
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.
This commit is contained in:
parent
5384e84c46
commit
1a27c323dd
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user