From 10a9960f0af9d6fb93ff3d234b2a989f9bc00b21 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 12 Jul 2021 17:09:03 -0600 Subject: [PATCH] [buffer] Restructure swap_buffers() Is more of a "commit" operation now. Will rename when ready. --- src/hb-buffer.cc | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/hb-buffer.cc b/src/hb-buffer.cc index 7ca988dbc..583137a58 100644 --- a/src/hb-buffer.cc +++ b/src/hb-buffer.cc @@ -317,29 +317,23 @@ hb_buffer_t::clear_positions () void hb_buffer_t::swap_buffers () { - if (unlikely (!successful)) return; + assert (have_output); assert (idx <= len); - if (unlikely (!next_glyphs (len - idx))) return; - assert (have_output); - have_output = false; + if (unlikely (!successful || !next_glyphs (len - idx))) + goto reset; if (out_info != info) { - hb_glyph_info_t *tmp; - tmp = info; + pos = (hb_glyph_position_t *) info; info = out_info; - out_info = tmp; - - pos = (hb_glyph_position_t *) out_info; } - - unsigned int tmp; - tmp = len; len = out_len; - out_len = tmp; +reset: + have_output = false; + out_len = 0; idx = 0; }