summaryrefslogtreecommitdiff
path: root/src/tokeniser/tokeniser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tokeniser/tokeniser.c')
-rw-r--r--src/tokeniser/tokeniser.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/tokeniser/tokeniser.c b/src/tokeniser/tokeniser.c
index 755b3b5..1fdaddb 100644
--- a/src/tokeniser/tokeniser.c
+++ b/src/tokeniser/tokeniser.c
@@ -2861,19 +2861,20 @@ hubbub_error emit_current_tag(hubbub_tokeniser *tokeniser)
continue;
}
+ assert(i < j);
+
/* Calculate amount to move */
- move = (n_attributes - 1 -
- ((i < j) ? j : i)) *
+ move = (n_attributes - 1 - j) *
sizeof(hubbub_attribute);
if (move > 0) {
- memmove((i < j) ? &attrs[j]
- : &attrs[i],
- (i < j) ? &attrs[j+1]
- : &attrs[i+1],
- move);
+ memmove(&attrs[j],&attrs[j+1], move);
}
+ /* We've deleted an item, so we need to
+ * reprocess this index */
+ j--;
+
/* And reduce the number of attributes */
n_attributes--;
}