[vlc-devel] [PATCH 2/2] demux/playlist/dvb: simplify parsing

Filip Roséen filip at atch.se
Wed Mar 15 10:10:38 CET 2017


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.
---
 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 72d07d3242..5f82749922 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;
 
-- 
2.12.0


More information about the vlc-devel mailing list