mirror of
https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git
synced 2024-11-26 21:33:42 +08:00
util: Promote path_is_absolute() to header
This is a trivial function that can be used elsewhere. There's no point in keeping the assert if we are going to crash in the very next instruction. Rather add the relevant attribute and drop the assert. Signed-off-by: Lucas De Marchi <lucas.de.marchi@gmail.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Link: https://github.com/kmod-project/kmod/pull/243
This commit is contained in:
parent
e82a548cb2
commit
63302cf655
@ -369,13 +369,6 @@ char *freadline_wrapped(FILE *fp, unsigned int *linenum)
|
||||
/* path handling functions */
|
||||
/* ************************************************************************ */
|
||||
|
||||
static bool path_is_absolute(const char *p)
|
||||
{
|
||||
assert(p != NULL);
|
||||
|
||||
return p[0] == '/';
|
||||
}
|
||||
|
||||
char *path_make_absolute_cwd(const char *p)
|
||||
{
|
||||
_cleanup_free_ char *cwd = NULL;
|
||||
|
@ -45,6 +45,11 @@ _nonnull_(1) char *freadline_wrapped(FILE *fp, unsigned int *linenum);
|
||||
/* path handling functions */
|
||||
/* ************************************************************************ */
|
||||
_must_check_ _nonnull_all_ char *path_make_absolute_cwd(const char *p);
|
||||
static inline _must_check_ _nonnull_all_ bool path_is_absolute(const char *p)
|
||||
{
|
||||
return p[0] == '/';
|
||||
}
|
||||
|
||||
int mkdir_p(const char *path, int len, mode_t mode);
|
||||
int mkdir_parents(const char *path, mode_t mode);
|
||||
unsigned long long stat_mstamp(const struct stat *st);
|
||||
|
Loading…
Reference in New Issue
Block a user