From ddea4d19cf6d64270e14418f02e7ff1f1b9458db Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 25 Aug 2018 21:08:15 -0700 Subject: [PATCH] Add 1-param passthrough constructor to hb_auto_t<> And use. --- src/hb-dsalgs.hh | 1 + src/hb-ot-cmap-table.hh | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh index 8d59c6cf3..c7aa611e4 100644 --- a/src/hb-dsalgs.hh +++ b/src/hb-dsalgs.hh @@ -492,6 +492,7 @@ template struct hb_auto_t : Type { hb_auto_t (void) { Type::init (); } + template hb_auto_t (T1 t1) { Type::init (t1); } ~hb_auto_t (void) { Type::fini (); } private: /* Hide */ void init (void) {} diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index dcdff008e..af814bfb6 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -243,6 +243,7 @@ struct CmapSubtableFormat4 glyphIdArray = idRangeOffset + segCount; glyphIdArrayLength = (subtable->length - 16 - 8 * segCount) / 2; } + inline void fini (void) {} inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const { @@ -313,14 +314,12 @@ struct CmapSubtableFormat4 inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const { - accelerator_t accel; - accel.init (this); + hb_auto_t accel (this); return accel.get_glyph_func (&accel, codepoint, glyph); } inline void collect_unicodes (hb_set_t *out) const { - accelerator_t accel; - accel.init (this); + hb_auto_t accel (this); accel.collect_unicodes (out); }