[Spice-commits] server/reds.c
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 29 21:05:49 UTC 2018
server/reds.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
New commits:
commit 6842f799db2446c29798fa6dc2acd39e1494a478
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Tue Jun 26 10:51:40 2018 +0100
reds: Reuse strspn and strcspn functions
These functions are in the standard C library, not well known
but quite useful for parsing strings.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/reds.c b/server/reds.c
index 4b2c9919..4d343b25 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3549,19 +3549,14 @@ static const char* parse_video_codecs(const char *codecs, char **encoder,
if (!codecs) {
return NULL;
}
- while (*codecs == ';') {
- codecs++;
- }
+ codecs += strspn(codecs, ";");
if (!*codecs) {
return NULL;
}
int n;
*encoder = *codec = NULL;
if (sscanf(codecs, "%m[0-9a-zA-Z_]:%m[0-9a-zA-Z_]%n", encoder, codec, &n) != 2) {
- while (*codecs != '\0' && *codecs != ';') {
- codecs++;
- }
- return codecs;
+ return codecs + strcspn(codecs, ";");
}
return codecs + n;
}
More information about the Spice-commits
mailing list