[vlc-commits] demux/playlist/dvb: simplify parsing

Filip Roséen git at videolan.org
Wed Mar 15 19:34:49 CET 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Wed Mar 15 10:10:38 2017 +0100| [3c984e7a8d32c6a014426e8ae0f4de3d7faace7f] | committer: Jean-Baptiste Kempf

demux/playlist/dvb: simplify parsing

the variable named str is not referred to after the lines in question,
as such this simplifies the implementation after the recent changes to
ParseFEC, ParseModulation, and ParseGuard.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3c984e7a8d32c6a014426e8ae0f4de3d7faace7f
---

 modules/demux/playlist/dvb.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/modules/demux/playlist/dvb.c b/modules/demux/playlist/dvb.c
index 72d07d3..5f82749 100644
--- a/modules/demux/playlist/dvb.c
+++ b/modules/demux/playlist/dvb.c
@@ -251,10 +251,8 @@ static input_item_t *ParseLine(char *line)
             if (*end)
                 return NULL;
 
-            str = strsep(&line, ":");
-            const char *fec = ParseFEC(str);
-            str = strsep(&line, ":");
-            const char *mod = ParseModulation(str);
+            const char *fec = ParseFEC(strsep(&line, ":"));
+            const char *mod = ParseModulation(strsep(&line,":"));
             if (fec == NULL || mod == NULL)
                 return NULL;
 
@@ -267,12 +265,10 @@ static input_item_t *ParseLine(char *line)
         {   /* DVB-T */
             unsigned bandwidth = atoi(str + 10);
 
-            str = strsep(&line, ":");
-            const char *hp = ParseFEC(str);
-            str = strsep(&line, ":");
-            const char *lp = ParseFEC(str);
-            str = strsep(&line, ":");
-            const char *mod = ParseModulation(str);
+            const char *hp = ParseFEC(strsep(&line, ":"));
+            const char *lp = ParseFEC(strsep(&line, ":"));
+            const char *mod = ParseModulation(strsep(&line, ":"));
+
             if (hp == NULL || lp == NULL || mod == NULL)
                 return NULL;
 
@@ -283,8 +279,7 @@ static input_item_t *ParseLine(char *line)
             if (xmit == 0)
                 xmit = -1; /* AUTO */
 
-            str = strsep(&line, ":");
-            const char *guard = ParseGuard(str);
+            const char *guard = ParseGuard(strsep(&line,":"));
             if (guard == NULL)
                 return NULL;
 



More information about the vlc-commits mailing list