Minor refactoring
diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc
index 59a5bbc..6a0c786 100644
--- a/src/hb-ot-shape.cc
+++ b/src/hb-ot-shape.cc
@@ -401,6 +401,30 @@
 /* Position */
 
 static inline void
+zero_mark_widths_by_unicode (hb_buffer_t *buffer)
+{
+  unsigned int count = buffer->len;
+  for (unsigned int i = 0; i < count; i++)
+    if (_hb_glyph_info_get_general_category (&buffer->info[i]) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
+    {
+      buffer->pos[i].x_advance = 0;
+      buffer->pos[i].y_advance = 0;
+    }
+}
+
+static inline void
+zero_mark_widths_by_gdef (hb_buffer_t *buffer)
+{
+  unsigned int count = buffer->len;
+  for (unsigned int i = 0; i < count; i++)
+    if ((buffer->info[i].glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK))
+    {
+      buffer->pos[i].x_advance = 0;
+      buffer->pos[i].y_advance = 0;
+    }
+}
+
+static inline void
 hb_ot_position_default (hb_ot_shape_context_t *c)
 {
   hb_ot_layout_position_start (c->font, c->buffer);
@@ -421,25 +445,13 @@
 
   switch (c->plan->shaper->zero_width_marks)
   {
-    /* Zero'ing mark widths by GDEF (as used in Myanmar spec) may happen
-     * *before* GPOS. */
     case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_EARLY:
-      for (unsigned int i = 0; i < count; i++)
-	if ((c->buffer->info[i].glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK))
-	{
-	  c->buffer->pos[i].x_advance = 0;
-	  c->buffer->pos[i].y_advance = 0;
-	}
+      zero_mark_widths_by_gdef (c->buffer);
       break;
 
     /* Not currently used for any shaper:
     case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_EARLY:
-      for (unsigned int i = 0; i < count; i++)
-	if (_hb_glyph_info_get_general_category (&c->buffer->info[i]) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
-	{
-	  c->buffer->pos[i].x_advance = 0;
-	  c->buffer->pos[i].y_advance = 0;
-	}
+      zero_mark_widths_by_unicode (c->buffer);
       break;
     */
 
@@ -483,21 +495,11 @@
   switch (c->plan->shaper->zero_width_marks)
   {
     case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_UNICODE_LATE:
-      for (unsigned int i = 0; i < count; i++)
-	if (_hb_glyph_info_get_general_category (&c->buffer->info[i]) == HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK)
-	{
-	  c->buffer->pos[i].x_advance = 0;
-	  c->buffer->pos[i].y_advance = 0;
-	}
+      zero_mark_widths_by_unicode (c->buffer);
       break;
 
     case HB_OT_SHAPE_ZERO_WIDTH_MARKS_BY_GDEF_LATE:
-      for (unsigned int i = 0; i < count; i++)
-	if ((c->buffer->info[i].glyph_props() & HB_OT_LAYOUT_GLYPH_PROPS_MARK))
-	{
-	  c->buffer->pos[i].x_advance = 0;
-	  c->buffer->pos[i].y_advance = 0;
-	}
+      zero_mark_widths_by_gdef (c->buffer);
       break;
 
     default: