util: rename join() to strjoin()
This is to match strappend() and the other string related functions.
This commit is contained in:
@@ -522,16 +522,16 @@ static int join_path(const char *controller, const char *path, const char *suffi
|
||||
|
||||
if (controller) {
|
||||
if (path && suffix)
|
||||
t = join("/sys/fs/cgroup/", controller, "/", path, "/", suffix, NULL);
|
||||
t = strjoin("/sys/fs/cgroup/", controller, "/", path, "/", suffix, NULL);
|
||||
else if (path)
|
||||
t = join("/sys/fs/cgroup/", controller, "/", path, NULL);
|
||||
t = strjoin("/sys/fs/cgroup/", controller, "/", path, NULL);
|
||||
else if (suffix)
|
||||
t = join("/sys/fs/cgroup/", controller, "/", suffix, NULL);
|
||||
t = strjoin("/sys/fs/cgroup/", controller, "/", suffix, NULL);
|
||||
else
|
||||
t = join("/sys/fs/cgroup/", controller, NULL);
|
||||
t = strjoin("/sys/fs/cgroup/", controller, NULL);
|
||||
} else {
|
||||
if (path && suffix)
|
||||
t = join(path, "/", suffix, NULL);
|
||||
t = strjoin(path, "/", suffix, NULL);
|
||||
else if (path)
|
||||
t = strdup(path);
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ int config_item_perf_lookup(
|
||||
else {
|
||||
char *key;
|
||||
|
||||
key = join(section, ".", lvalue, NULL);
|
||||
key = strjoin(section, ".", lvalue, NULL);
|
||||
if (!key)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ static int rtc_open(int flags) {
|
||||
if (ignore_file(de->d_name))
|
||||
continue;
|
||||
|
||||
p = join("/sys/class/rtc/", de->d_name, "/hctosys", NULL);
|
||||
p = strjoin("/sys/class/rtc/", de->d_name, "/hctosys", NULL);
|
||||
if (!p) {
|
||||
closedir(d);
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -120,7 +120,7 @@ char *path_make_absolute(const char *p, const char *prefix) {
|
||||
if (path_is_absolute(p) || !prefix)
|
||||
return strdup(p);
|
||||
|
||||
return join(prefix, "/", p, NULL);
|
||||
return strjoin(prefix, "/", p, NULL);
|
||||
}
|
||||
|
||||
char *path_make_absolute_cwd(const char *p) {
|
||||
|
||||
@@ -208,7 +208,7 @@ char *unit_name_build(const char *prefix, const char *instance, const char *suff
|
||||
if (!instance)
|
||||
return strappend(prefix, suffix);
|
||||
|
||||
return join(prefix, "@", instance, suffix, NULL);
|
||||
return strjoin(prefix, "@", instance, suffix, NULL);
|
||||
}
|
||||
|
||||
static char *do_escape_char(char c, char *t) {
|
||||
@@ -425,7 +425,7 @@ char *unit_name_from_path_instance(const char *prefix, const char *path, const c
|
||||
if (!p)
|
||||
return NULL;
|
||||
|
||||
r = join(prefix, "@", p, suffix, NULL);
|
||||
r = strjoin(prefix, "@", p, suffix, NULL);
|
||||
free(p);
|
||||
|
||||
return r;
|
||||
|
||||
+2
-2
@@ -1083,7 +1083,7 @@ int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char *
|
||||
if (h < 0)
|
||||
return h;
|
||||
|
||||
r = join("[", t, "]", NULL);
|
||||
r = strjoin("[", t, "]", NULL);
|
||||
free(t);
|
||||
|
||||
if (!r)
|
||||
@@ -5145,7 +5145,7 @@ finish:
|
||||
return r;
|
||||
}
|
||||
|
||||
char *join(const char *x, ...) {
|
||||
char *strjoin(const char *x, ...) {
|
||||
va_list ap;
|
||||
size_t l;
|
||||
char *r, *p;
|
||||
|
||||
+1
-1
@@ -451,7 +451,7 @@ int dirent_ensure_type(DIR *d, struct dirent *de);
|
||||
int in_search_path(const char *path, char **search);
|
||||
int get_files_in_directory(const char *path, char ***list);
|
||||
|
||||
char *join(const char *x, ...) _sentinel_;
|
||||
char *strjoin(const char *x, ...) _sentinel_;
|
||||
|
||||
bool is_main_thread(void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user