From 17335a8161e674e630287e18a6d304ec0c33767c Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 4 Nov 2018 02:25:07 -0500 Subject: [PATCH] Clean up buffer->swap_buffers() calls That function checks for buffer->successful already. No need to check at call site. --- src/gen-vowel-constraints.py | 4 +--- src/hb-aat-layout-common.hh | 3 +-- src/hb-aat-layout-morx-table.hh | 3 +-- src/hb-ot-shape-complex-indic.cc | 1 - src/hb-ot-shape-complex-khmer.cc | 1 - src/hb-ot-shape-complex-myanmar.cc | 1 - src/hb-ot-shape-complex-thai.cc | 3 +-- src/hb-ot-shape-complex-use.cc | 1 - src/hb-ot-shape-complex-vowel-constraints.cc | 5 ++--- src/hb-ot-shape.cc | 1 - 10 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/gen-vowel-constraints.py b/src/gen-vowel-constraints.py index c4e75aa96..b7f6be223 100755 --- a/src/gen-vowel-constraints.py +++ b/src/gen-vowel-constraints.py @@ -211,9 +211,7 @@ print (' }') print (' if (processed)') print (' {') print (' if (buffer->idx < count)') -print (' buffer->next_glyph ();') -print (' if (likely (buffer->successful))') -print (' buffer->swap_buffers ();') +print (' buffer->next_glyph ();') print (' }') print ('}') diff --git a/src/hb-aat-layout-common.hh b/src/hb-aat-layout-common.hh index 51add2213..11c6c5a8b 100644 --- a/src/hb-aat-layout-common.hh +++ b/src/hb-aat-layout-common.hh @@ -671,8 +671,7 @@ struct StateTableDriver { for (; buffer->successful && buffer->idx < buffer->len;) buffer->next_glyph (); - if (likely (buffer->successful)) - buffer->swap_buffers (); + buffer->swap_buffers (); } } diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh index dab6ec1e9..2bc60182e 100644 --- a/src/hb-aat-layout-morx-table.hh +++ b/src/hb-aat-layout-morx-table.hh @@ -1121,8 +1121,7 @@ struct mortmorx else buffer->next_glyph (); } - if (likely (buffer->successful)) - buffer->swap_buffers (); + buffer->swap_buffers (); } inline void apply (hb_aat_apply_context_t *c) const diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 4f98f7480..8933c1822 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -1018,7 +1018,6 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, else buffer->next_glyph (); } - buffer->swap_buffers (); } diff --git a/src/hb-ot-shape-complex-khmer.cc b/src/hb-ot-shape-complex-khmer.cc index 1142da3ec..497891ea0 100644 --- a/src/hb-ot-shape-complex-khmer.cc +++ b/src/hb-ot-shape-complex-khmer.cc @@ -414,7 +414,6 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, else buffer->next_glyph (); } - buffer->swap_buffers (); } diff --git a/src/hb-ot-shape-complex-myanmar.cc b/src/hb-ot-shape-complex-myanmar.cc index dcada261c..ca7b5a9b2 100644 --- a/src/hb-ot-shape-complex-myanmar.cc +++ b/src/hb-ot-shape-complex-myanmar.cc @@ -343,7 +343,6 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, else buffer->next_glyph (); } - buffer->swap_buffers (); } diff --git a/src/hb-ot-shape-complex-thai.cc b/src/hb-ot-shape-complex-thai.cc index b687fe61e..650c9800a 100644 --- a/src/hb-ot-shape-complex-thai.cc +++ b/src/hb-ot-shape-complex-thai.cc @@ -357,8 +357,7 @@ preprocess_text_thai (const hb_ot_shape_plan_t *plan, buffer->merge_out_clusters (start - 1, end); } } - if (likely (buffer->successful)) - buffer->swap_buffers (); + buffer->swap_buffers (); /* If font has Thai GSUB, we are done. */ if (plan->props.script == HB_SCRIPT_THAI && !plan->map.found_script[0]) diff --git a/src/hb-ot-shape-complex-use.cc b/src/hb-ot-shape-complex-use.cc index 3ab77fc58..af25b07f8 100644 --- a/src/hb-ot-shape-complex-use.cc +++ b/src/hb-ot-shape-complex-use.cc @@ -552,7 +552,6 @@ insert_dotted_circles (const hb_ot_shape_plan_t *plan HB_UNUSED, else buffer->next_glyph (); } - buffer->swap_buffers (); } diff --git a/src/hb-ot-shape-complex-vowel-constraints.cc b/src/hb-ot-shape-complex-vowel-constraints.cc index 20af8711e..0e532581d 100644 --- a/src/hb-ot-shape-complex-vowel-constraints.cc +++ b/src/hb-ot-shape-complex-vowel-constraints.cc @@ -429,9 +429,8 @@ _hb_preprocess_text_vowel_constraints (const hb_ot_shape_plan_t *plan HB_UNUSED, if (processed) { if (buffer->idx < count) - buffer->next_glyph (); - if (likely (buffer->successful)) - buffer->swap_buffers (); + buffer->next_glyph (); + buffer->swap_buffers (); } } diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index b687996f6..8c5e38e06 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -425,7 +425,6 @@ hb_insert_dotted_circle (hb_buffer_t *buffer, hb_font_t *font) buffer->output_info (info); while (buffer->idx < buffer->len && buffer->successful) buffer->next_glyph (); - buffer->swap_buffers (); }