md4c

C Markdown parser. Fast. SAX-like interface. Compliant to CommonMark specification.
git clone https://noulin.net/git/md4c.git
Log | Files | Refs | README | LICENSE

commit a638a4223d5042c5dd50e482d427572ae106f4c2
parent 6bc0b86101e1efa18eaa8d0c045d83982b89ec47
Author: Martin Mitas <mity@morous.org>
Date:   Tue, 18 Jul 2017 19:04:08 +0200

md_build_ref_def_hashtable: Fix variable conflict.

By copy&paste error, we have used two nested loops to use the same
iterator.

Diffstat:
Mmd4c/md4c.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/md4c/md4c.c b/md4c/md4c.c @@ -1660,7 +1660,7 @@ md_ref_def_cmp_stable(const void* a, const void* b) static int md_build_ref_def_hashtable(MD_CTX* ctx) { - int i; + int i, j; if(ctx->n_ref_defs == 0) return 0; @@ -1749,9 +1749,9 @@ md_build_ref_def_hashtable(MD_CTX* ctx) qsort(list->ref_defs, list->n_ref_defs, sizeof(MD_REF_DEF*), md_ref_def_cmp_stable); /* Disable duplicates. */ - for(i = 1; i < list->n_ref_defs; i++) { - if(md_ref_def_cmp(&list->ref_defs[i-1], &list->ref_defs[i]) == 0) - list->ref_defs[i] = list->ref_defs[i-1]; + for(j = 1; j < list->n_ref_defs; j++) { + if(md_ref_def_cmp(&list->ref_defs[j-1], &list->ref_defs[j]) == 0) + list->ref_defs[j] = list->ref_defs[j-1]; } }