diff options
author | Limin Wang <lance.lmwang@gmail.com> | 2019-09-24 14:23:58 +0300 |
---|---|---|
committer | Steven Liu <lq@chinaffmpeg.org> | 2019-10-08 09:12:43 +0300 |
commit | a77fb510c2684a43980c79ff85ff36e094cae63c (patch) | |
tree | 7b1878c4e9ae07bab2f2032ac15a3000be6579e2 /libavutil/avstring.h | |
parent | 985ed65117c7c82255bb0931442725aa6e5f6967 (diff) |
avutil/avstring: support input path as a null pointer or empty string
Linux and OSX systems support basename and dirname via <libgen.h>, I plan to
make the wrapper interface conform to the standard interface first.
If it is feasible, I will continue to modify it to call the system interface
if there is already a system call interface.
You can get more description about the system interface by below command:
"man 3 basename"
Reviewed-by: Marton Balint <cus@passwd.hu>
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Diffstat (limited to 'libavutil/avstring.h')
-rw-r--r-- | libavutil/avstring.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libavutil/avstring.h b/libavutil/avstring.h index 37dd4e2da0..274335cfb9 100644 --- a/libavutil/avstring.h +++ b/libavutil/avstring.h @@ -274,16 +274,21 @@ char *av_strireplace(const char *str, const char *from, const char *to); /** * Thread safe basename. - * @param path the path, on DOS both \ and / are considered separators. + * @param path the string to parse, on DOS both \ and / are considered separators. * @return pointer to the basename substring. + * If path does not contain a slash, the function returns a copy of path. + * If path is a NULL pointer or points to an empty string, a pointer + * to a string "." is returned. */ const char *av_basename(const char *path); /** * Thread safe dirname. - * @param path the path, on DOS both \ and / are considered separators. - * @return the path with the separator replaced by the string terminator or ".". - * @note the function may change the input string. + * @param path the string to parse, on DOS both \ and / are considered separators. + * @return A pointer to a string that's the parent directory of path. + * If path is a NULL pointer or points to an empty string, a pointer + * to a string "." is returned. + * @note the function may modify the contents of the path, so copies should be passed. */ const char *av_dirname(char *path); |