Add HB_DISALLOW_COPY_AND_ASSIGN
authorBehdad Esfahbod <behdad@behdad.org>
Fri, 25 May 2018 23:21:27 +0000 (16:21 -0700)
committerBehdad Esfahbod <behdad@behdad.org>
Fri, 25 May 2018 23:21:27 +0000 (16:21 -0700)
src/hb-ot-map-private.hh
src/hb-ot-shape-private.hh
src/hb-ot-shape.cc
src/hb-private.hh
src/hb-set-private.hh

index f34c2bf..22f2749 100644 (file)
@@ -78,7 +78,6 @@ struct hb_ot_map_t
     pause_func_t pause_func;
   };
 
-
   hb_ot_map_t (void) { memset (this, 0, sizeof (*this)); }
 
   inline hb_mask_t get_global_mask (void) const { return global_mask; }
index fddb757..c217af0 100644 (file)
@@ -99,9 +99,7 @@ struct hb_ot_shape_planner_t
   }
 
   private:
-  /* No copy. */
-  hb_ot_shape_planner_t (const hb_ot_shape_planner_t &);
-  hb_ot_shape_planner_t &operator = (const hb_ot_shape_planner_t &);
+  HB_DISALLOW_COPY_AND_ASSIGN (hb_ot_shape_planner_t);
 };
 
 
index 5dc5784..f68c0f6 100644 (file)
@@ -942,8 +942,6 @@ hb_ot_shape_glyphs_closure (hb_font_t          *font,
                            unsigned int        num_features,
                            hb_set_t           *glyphs)
 {
-  hb_ot_shape_plan_t plan;
-
   const char *shapers[] = {"ot", nullptr};
   hb_shape_plan_t *shape_plan = hb_shape_plan_create_cached (font->face, &buffer->props,
                                                             features, num_features, shapers);
index d2540d3..0c291a1 100644 (file)
@@ -536,6 +536,13 @@ _hb_ceil_to_4 (unsigned int v)
  *
  */
 
+#define HB_DISALLOW_ASSIGN(TypeName) \
+  void operator=(const TypeName&) = delete
+
+#define HB_DISALLOW_COPY_AND_ASSIGN(TypeName) \
+  TypeName(const TypeName&) = delete; \
+  void operator=(const TypeName&) = delete
+
 /*
  * Static pools
  */
@@ -800,6 +807,9 @@ struct hb_vector_t
     arrayZ = nullptr;
     allocated = len = 0;
   }
+
+  private:
+  HB_DISALLOW_ASSIGN (hb_vector_t);
 };
 
 template <typename Type>
index 7a604e1..07f8a57 100644 (file)
@@ -675,6 +675,9 @@ struct hb_set_t
   inline const page_t &page_at (unsigned int i) const { return pages[page_map[i].index]; }
   inline unsigned int get_major (hb_codepoint_t g) const { return g / page_t::PAGE_BITS; }
   inline hb_codepoint_t major_start (unsigned int major) const { return major * page_t::PAGE_BITS; }
+
+  private:
+  HB_DISALLOW_COPY_AND_ASSIGN (hb_set_t);
 };