Add helper path_is_absolute()

This commit is contained in:
Lucas De Marchi 2011-12-07 13:50:52 -02:00
parent a5cce6d6ef
commit 3a468809b8
2 changed files with 8 additions and 0 deletions

View File

@ -116,6 +116,7 @@ ssize_t read_str_safe(int fd, char *buf, size_t buflen) __must_check __attribute
int read_str_long(int fd, long *value, int base) __must_check __attribute__((nonnull(2)));
int read_str_ulong(int fd, unsigned long *value, int base) __must_check __attribute__((nonnull(2)));
char *strchr_replace(char *s, int c, char r);
bool path_is_absolute(const char *p) __must_check __attribute__((nonnull(1)));
#endif

View File

@ -214,3 +214,10 @@ char *strchr_replace(char *s, int c, char r)
return s;
}
bool path_is_absolute(const char *p)
{
assert(p != NULL);
return p[0] == '/';
}