Commit 8dd35762d99cbd5fc3d1860bced5e8566e58d9f4

Martin Mitas 2022-01-11T20:53:04

md_analyze_dollar: Simplify the function.

diff --git a/src/md4c.c b/src/md4c.c
index 7fdc8e2..c697053 100644
--- a/src/md4c.c
+++ b/src/md4c.c
@@ -3853,14 +3853,11 @@ md_analyze_dollar(MD_CTX* ctx, int mark_index)
         if (open->end - open->beg == close->end - close->beg) {
             /* We are the matching closer */
             md_resolve_range(ctx, &DOLLAR_OPENERS, opener_index, mark_index);
-        } else {
-            /* We don't match the opener, so discard old opener and insert as opener */
-            md_mark_chain_append(ctx, &DOLLAR_OPENERS, mark_index);
+            return;
         }
-    } else {
-        /* No unmatched openers, so we are opener */
-        md_mark_chain_append(ctx, &DOLLAR_OPENERS, mark_index);
     }
+
+    md_mark_chain_append(ctx, &DOLLAR_OPENERS, mark_index);
 }
 
 static void