cmark

My personal build of CMark ✏️

Commit
aa2f771502ad48842bf084ccd67aaa19cac590c0
Parent
1acd161b2f25e71a40c903ea8997a6ee2f4694d2
Author
John MacFarlane <jgm@berkeley.edu>
Date

Code simplification.

Diffstat

1 file changed, 4 insertions, 4 deletions

Status File Name N° Changes Insertions Deletions
Modified src/inlines.c 8 4 4
diff --git a/src/inlines.c b/src/inlines.c
@@ -440,7 +440,7 @@ static void process_emphasis(subject *subj, delimiter *start_delim)
 	delimiter *closer = subj->last_delim;
 	delimiter *opener;
 	delimiter *old_closer;
-	bool opener_not_found;
+	bool opener_found;
 
 	// move back to first relevant delim.
 	while (closer != NULL && closer->previous != start_delim) {
@@ -454,15 +454,15 @@ static void process_emphasis(subject *subj, delimiter *start_delim)
 		     closer->delim_char == '"' || closer->delim_char == '\'')) {
 			// Now look backwards for first matching opener:
 			opener = closer->previous;
+			opener_found = false;
 			while (opener != NULL && opener != start_delim) {
 				if (opener->delim_char == closer->delim_char &&
 				    opener->can_open) {
+					opener_found = true;
 					break;
 				}
 				opener = opener->previous;
 			}
-			opener_not_found = opener == NULL ||
-				opener == start_delim;
 			old_closer = closer;
 			if (closer->delim_char == '*' || closer->delim_char == '_') {
 				if (opener != NULL && opener != start_delim) {
@@ -491,7 +491,7 @@ static void process_emphasis(subject *subj, delimiter *start_delim)
 				}
 				closer = closer->next;
 			}
-			if (opener_not_found && !old_closer->can_open) {
+			if (!opener_found && !old_closer->can_open) {
 				// we can remove a closer that can't be an
 				// opener, once we've seen there's no
 				// matching opener: