basic/path-util: change 'char *func' to 'char* func'

Both styles were mixed in the file, but I find the latter much nicer,
because it's not the func that is the pointer, but the return type.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2023-09-18 14:09:34 +02:00
parent 8f1998b8d3
commit 00d811a548
2 changed files with 12 additions and 12 deletions
+8 -8
View File
@@ -40,7 +40,7 @@ int path_split_and_make_absolute(const char *p, char ***ret) {
return r;
}
char *path_make_absolute(const char *p, const char *prefix) {
char* path_make_absolute(const char *p, const char *prefix) {
assert(p);
/* Makes every item in the list an absolute path by prepending
@@ -252,7 +252,7 @@ int path_strv_make_absolute_cwd(char **l) {
return 0;
}
char **path_strv_resolve(char **l, const char *root) {
char** path_strv_resolve(char **l, const char *root) {
unsigned k = 0;
bool enomem = false;
int r;
@@ -333,7 +333,7 @@ char **path_strv_resolve(char **l, const char *root) {
return l;
}
char **path_strv_resolve_uniq(char **l, const char *root) {
char** path_strv_resolve_uniq(char **l, const char *root) {
if (strv_isempty(l))
return l;
@@ -344,7 +344,7 @@ char **path_strv_resolve_uniq(char **l, const char *root) {
return strv_uniq(l);
}
char *path_simplify_full(char *path, PathSimplifyFlags flags) {
char* path_simplify_full(char *path, PathSimplifyFlags flags) {
bool add_slash = false, keep_trailing_slash;
char *f = ASSERT_PTR(path);
int r;
@@ -397,7 +397,7 @@ char *path_simplify_full(char *path, PathSimplifyFlags flags) {
return path;
}
char *path_startswith_full(const char *path, const char *prefix, bool accept_dot_dot) {
char* path_startswith_full(const char *path, const char *prefix, bool accept_dot_dot) {
assert(path);
assert(prefix);
@@ -807,7 +807,7 @@ int fsck_exists_for_fstype(const char *fstype) {
return executable_is_good(checker);
}
static const char *skip_slash_or_dot(const char *p) {
static const char* skip_slash_or_dot(const char *p) {
for (; !isempty(p); p++) {
if (*p == '/')
continue;
@@ -891,7 +891,7 @@ int path_find_first_component(const char **p, bool accept_dot_dot, const char **
return len;
}
static const char *skip_slash_or_dot_backward(const char *path, const char *q) {
static const char* skip_slash_or_dot_backward(const char *path, const char *q) {
assert(path);
assert(!q || q >= path);
@@ -1000,7 +1000,7 @@ int path_find_last_component(const char *path, bool accept_dot_dot, const char *
return len;
}
const char *last_path_component(const char *path) {
const char* last_path_component(const char *path) {
/* Finds the last component of the path, preserving the optional trailing slash that signifies a directory.
*
+4 -4
View File
@@ -53,7 +53,7 @@ int safe_getcwd(char **ret);
int path_make_absolute_cwd(const char *p, char **ret);
int path_make_relative(const char *from, const char *to, char **ret);
int path_make_relative_parent(const char *from_child, const char *to, char **ret);
char *path_startswith_full(const char *path, const char *prefix, bool accept_dot_dot) _pure_;
char* path_startswith_full(const char *path, const char *prefix, bool accept_dot_dot) _pure_;
static inline char* path_startswith(const char *path, const char *prefix) {
return path_startswith_full(path, prefix, true);
}
@@ -80,7 +80,7 @@ typedef enum PathSimplifyFlags {
PATH_SIMPLIFY_KEEP_TRAILING_SLASH = 1 << 0,
} PathSimplifyFlags;
char *path_simplify_full(char *path, PathSimplifyFlags flags);
char* path_simplify_full(char *path, PathSimplifyFlags flags);
static inline char* path_simplify(char *path) {
return path_simplify_full(path, 0);
}
@@ -159,7 +159,7 @@ int fsck_exists_for_fstype(const char *fstype);
int path_find_first_component(const char **p, bool accept_dot_dot, const char **ret);
int path_find_last_component(const char *path, bool accept_dot_dot, const char **next, const char **ret);
const char *last_path_component(const char *path);
const char* last_path_component(const char *path);
int path_extract_filename(const char *path, char **ret);
int path_extract_directory(const char *path, char **ret);
@@ -196,7 +196,7 @@ static inline const char *skip_dev_prefix(const char *p) {
}
bool empty_or_root(const char *path);
static inline const char *empty_to_root(const char *path) {
static inline const char* empty_to_root(const char *path) {
return isempty(path) ? "/" : path;
}