[vlc-commits] sap: simplify
Rémi Denis-Courmont
git at videolan.org
Thu Nov 23 18:08:02 CET 2017
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Nov 23 19:05:17 2017 +0200| [d72395dd8aaf50a722cf7bbe58e4d61e9943edf2] | committer: Rémi Denis-Courmont
sap: simplify
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d72395dd8aaf50a722cf7bbe58e4d61e9943edf2
---
modules/services_discovery/sap.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c
index 7c5569171d..3350240809 100644
--- a/modules/services_discovery/sap.c
+++ b/modules/services_discovery/sap.c
@@ -1184,8 +1184,7 @@ static sdp_t *ParseSDP (vlc_object_t *p_obj, const char *psz_sdp)
while (*psz_sdp)
{
/* Extract one line */
- char *eol = strchr (psz_sdp, '\n');
- size_t linelen = eol ? (size_t)(eol - psz_sdp) : strlen (psz_sdp);
+ size_t linelen = strcspn(psz_sdp, "\n");
char line[linelen + 1];
memcpy (line, psz_sdp, linelen);
line[linelen] = '\0';
@@ -1193,7 +1192,7 @@ static sdp_t *ParseSDP (vlc_object_t *p_obj, const char *psz_sdp)
psz_sdp += linelen + 1;
/* Remove carriage return if present */
- eol = strchr (line, '\r');
+ char *eol = strchr (line, '\r');
if (eol != NULL)
{
linelen = eol - line;
More information about the vlc-commits
mailing list