diff options
author | wm4 <wm4@nowhere> | 2013-04-30 00:52:32 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-04-30 00:52:32 +0200 |
commit | ea7b920184a865a3343001318fc4a32dcfc7b4f5 (patch) | |
tree | fbefd8539b77ee7473ad73740cc8ffa97bc4ffbe /core/bstr.h | |
parent | 3dcc83a70609d392c8ecd917dd5c16995424e9c4 (diff) | |
parent | d98e61ea438db66323734ad1b6bea66411a3c97b (diff) | |
download | mpv-ea7b920184a865a3343001318fc4a32dcfc7b4f5.tar.bz2 mpv-ea7b920184a865a3343001318fc4a32dcfc7b4f5.tar.xz |
Merge branch 'master' into low_quality_intel_crap
Conflicts:
video/out/gl_video_shaders.glsl
video/out/vo_opengl.c
Diffstat (limited to 'core/bstr.h')
-rw-r--r-- | core/bstr.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/core/bstr.h b/core/bstr.h index bcac6cdba3..ce9e029ea5 100644 --- a/core/bstr.h +++ b/core/bstr.h @@ -40,6 +40,12 @@ static inline char *bstrdup0(void *talloc_ctx, struct bstr str) return talloc_strndup(talloc_ctx, (char *)str.start, str.len); } +// Like bstrdup0(), but always return a valid C-string. +static inline char *bstrto0(void *talloc_ctx, struct bstr str) +{ + return str.start ? bstrdup0(talloc_ctx, str) : talloc_strdup(talloc_ctx, ""); +} + // Return start = NULL iff that is true for the original. static inline struct bstr bstrdup(void *talloc_ctx, struct bstr str) { @@ -58,6 +64,7 @@ int bstrcmp(struct bstr str1, struct bstr str2); int bstrcasecmp(struct bstr str1, struct bstr str2); int bstrchr(struct bstr str, int c); int bstrrchr(struct bstr str, int c); +int bstrspn(struct bstr str, const char *accept); int bstrcspn(struct bstr str, const char *reject); int bstr_find(struct bstr haystack, struct bstr needle); |