tree-wide: replace strjoin() with path_join()
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include "memory-util.h"
|
||||
#include "missing.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
#include "process-util.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
@@ -3756,7 +3757,7 @@ _public_ int sd_bus_path_encode(const char *prefix, const char *external_id, cha
|
||||
if (!e)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = strjoin(prefix, "/", e);
|
||||
ret = path_join(prefix, e);
|
||||
if (!ret)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -752,7 +752,7 @@ static int parent_crawl_children(sd_device_enumerator *enumerator, const char *p
|
||||
if (dent->d_type != DT_DIR)
|
||||
continue;
|
||||
|
||||
child = strjoin(path, "/", dent->d_name);
|
||||
child = path_join(path, dent->d_name);
|
||||
if (!child)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ int device_set_syspath(sd_device *device, const char *_syspath, bool verify) {
|
||||
"sd-device: Canonicalized path '%s' does not starts with sysfs mount point '%s'",
|
||||
syspath, real_sys);
|
||||
|
||||
new_syspath = strjoin("/sys/", p);
|
||||
new_syspath = path_join("/sys", p);
|
||||
if (!new_syspath)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "log.h"
|
||||
#include "macro.h"
|
||||
#include "parse-util.h"
|
||||
#include "path-util.h"
|
||||
#include "process-util.h"
|
||||
#include "rm-rf.h"
|
||||
#include "signal-util.h"
|
||||
@@ -464,7 +465,7 @@ static void test_inotify(unsigned n_create_events) {
|
||||
_cleanup_free_ char *z;
|
||||
|
||||
xsprintf(buf, "%u", i);
|
||||
assert_se(z = strjoin(p, "/", buf));
|
||||
assert_se(z = path_join(p, buf));
|
||||
|
||||
assert_se(touch(z) >= 0);
|
||||
}
|
||||
|
||||
@@ -58,10 +58,7 @@ static int from_home_dir(const char *envname, const char *suffix, char **buffer,
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (endswith(h, "/"))
|
||||
cc = strappend(h, suffix);
|
||||
else
|
||||
cc = strjoin(h, "/", suffix);
|
||||
cc = path_join(h, suffix);
|
||||
if (!cc)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -374,11 +371,7 @@ _public_ int sd_path_home(uint64_t type, const char *suffix, char **path) {
|
||||
}
|
||||
|
||||
suffix += strspn(suffix, "/");
|
||||
|
||||
if (endswith(ret, "/"))
|
||||
cc = strappend(ret, suffix);
|
||||
else
|
||||
cc = strjoin(ret, "/", suffix);
|
||||
cc = path_join(ret, suffix);
|
||||
|
||||
free(buffer);
|
||||
|
||||
@@ -443,10 +436,7 @@ static int search_from_environment(
|
||||
if (!h && home_suffix) {
|
||||
e = secure_getenv("HOME");
|
||||
if (e && path_is_absolute(e)) {
|
||||
if (endswith(e, "/"))
|
||||
h = strappend(e, home_suffix);
|
||||
else
|
||||
h = strjoin(e, "/", home_suffix);
|
||||
h = path_join(e, home_suffix);
|
||||
|
||||
if (!h) {
|
||||
strv_free(l);
|
||||
@@ -621,12 +611,7 @@ _public_ int sd_path_search(uint64_t type, const char *suffix, char ***paths) {
|
||||
|
||||
j = n;
|
||||
STRV_FOREACH(i, l) {
|
||||
|
||||
if (endswith(*i, "/"))
|
||||
*j = strappend(*i, suffix);
|
||||
else
|
||||
*j = strjoin(*i, "/", suffix);
|
||||
|
||||
*j = path_join(*i, suffix);
|
||||
if (!*j)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user