OSDN Git Service

ffserver_config: reflow _get_arg()
authorReynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
Sat, 6 Dec 2014 05:14:20 +0000 (02:14 -0300)
committerReynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
Sat, 6 Dec 2014 05:24:53 +0000 (02:24 -0300)
Signed-off-by: Reynaldo H. Verdejo Pinochet <reynaldo@osg.samsung.com>
ffserver_config.c

index 1e79a5d..9f9655e 100644 (file)
@@ -84,28 +84,24 @@ void ffserver_get_arg(char *buf, int buf_size, const char **pp)
 {
     const char *p;
     char *q;
-    int quote;
+    int quote = 0;
 
     p = *pp;
-    while (av_isspace(*p)) p++;
     q = buf;
-    quote = 0;
+
+    while (av_isspace(*p)) p++;
+
     if (*p == '\"' || *p == '\'')
         quote = *p++;
-    for(;;) {
-        if (quote) {
-            if (*p == quote)
-                break;
-        } else {
-            if (av_isspace(*p))
-                break;
-        }
-        if (*p == '\0')
+
+    while (*p != '\0') {
+        if (quote && *p == quote || !quote && av_isspace(*p))
             break;
         if ((q - buf) < buf_size - 1)
             *q++ = *p;
         p++;
     }
+
     *q = '\0';
     if (quote && *p == quote)
         p++;