path-util: allow NULLs in arguments to path_join()

This removes the need to remember to put strempty() in places, thus reducing
the likelihood of a stupid mistake.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2018-11-30 22:21:17 +01:00
parent 62a85ee0a9
commit 652ef29887
8 changed files with 29 additions and 26 deletions
+2 -2
View File
@@ -49,8 +49,8 @@ char* path_startswith(const char *path, const char *prefix) _pure_;
int path_compare(const char *a, const char *b) _pure_;
bool path_equal(const char *a, const char *b) _pure_;
bool path_equal_or_files_same(const char *a, const char *b, int flags);
char* path_join_internal(const char *first, ...) _sentinel_;
#define path_join(x, ...) path_join_internal(x, __VA_ARGS__, NULL)
char* path_join_internal(const char *first, ...);
#define path_join(x, ...) path_join_internal(x, __VA_ARGS__, (const char*) -1)
char* path_simplify(char *path, bool kill_dots);