]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Kill useless use of goto
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 1 Dec 2008 05:01:24 +0000 (18:01 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 1 Dec 2008 05:01:24 +0000 (18:01 +1300)
src/mime.cc

index 69b7fdbbfb60608ecfe5fc3138764a7115c4d034..b0311286567149b672b40f6d7b6f6c6a6151e71e 100644 (file)
@@ -226,35 +226,35 @@ static mimeEntry *
 mimeGetEntry(const char *fn, int skip_encodings)
 {
     mimeEntry *m;
-    char *t;
+    char *t = NULL;
     char *name = xstrdup(fn);
 
-try_again:
-
-    for (m = MimeTable; m; m = m->next) {
-        if (regexec(&m->compiled_pattern, name, 0, 0, 0) == 0)
-            break;
-    }
+    do {
 
-    if (!skip_encodings)
-        (void) 0;
-    else if (m == NULL)
-        (void) 0;
-    else if (strcmp(m->content_type, dash_str))
-        (void) 0;
-    else if (!strcmp(m->content_encoding, dash_str))
-        (void) 0;
-    else {
-        /* Assume we matched /\.\w$/ and cut off the last extension */
-
-        if ((t = strrchr(name, '.'))) {
-            *t = '\0';
-            goto try_again;
+        for (m = MimeTable; m; m = m->next) {
+            if (regexec(&m->compiled_pattern, name, 0, 0, 0) == 0)
+                break;
         }
 
-        /* What? A encoding without a extension? */
-        m = NULL;
-    }
+        if (!skip_encodings)
+            (void) 0;
+        else if (m == NULL)
+            (void) 0;
+        else if (strcmp(m->content_type, dash_str))
+            (void) 0;
+        else if (!strcmp(m->content_encoding, dash_str))
+            (void) 0;
+        else {
+            /* Assume we matched /\.\w$/ and cut off the last extension */
+            if ((t = strrchr(name, '.'))) {
+                *t = '\0';
+            }
+            else {
+                /* What? A encoding without a extension? */
+                m = NULL;
+            }
+        }
+    } while(t);
 
     xfree(name);
     return m;