[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Sun Nov 25 05:21:38 UTC 2018


 src/hb-machinery.hh |   26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

New commits:
commit 6ee401049d475b2a2d9c859e6dbf8ff2750a1609
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Nov 25 00:21:13 2018 -0500

    Simplify sanitize set_object() / fix bots

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index 56e279e6..3717c4d3 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -259,17 +259,10 @@ struct hb_sanitize_context_t :
 
   inline void set_max_ops (int max_ops_) { max_ops = max_ops_; }
 
-  struct dummy_get_size_t
-  { inline unsigned int get_size (void) const { return 0; } };
-
-  template <typename T = dummy_get_size_t>
-  inline void set_object (const T *obj = nullptr)
+  template <typename T>
+  inline void set_object (const T *obj)
   {
-    this->start = this->blob->data;
-    this->end = this->start + this->blob->length;
-    assert (this->start <= this->end); /* Must not overflow. */
-
-    if (!obj) return;
+    reset_object ();
 
     const char *obj_start = (const char *) obj;
     const char *obj_end = (const char *) obj + obj->get_size ();
@@ -284,9 +277,16 @@ struct hb_sanitize_context_t :
     }
   }
 
+  inline void reset_object (void)
+  {
+    this->start = this->blob->data;
+    this->end = this->start + this->blob->length;
+    assert (this->start <= this->end); /* Must not overflow. */
+  }
+
   inline void start_processing (void)
   {
-    set_object ();
+    reset_object ();
     this->max_ops = MAX ((unsigned int) (this->end - this->start) * HB_SANITIZE_MAX_OPS_FACTOR,
 			 (unsigned) HB_SANITIZE_MAX_OPS_MIN);
     this->edit_count = 0;
@@ -482,7 +482,7 @@ struct hb_sanitize_context_t :
 
 struct hb_sanitize_with_object_t
 {
-  template <typename T = hb_sanitize_context_t::dummy_get_size_t>
+  template <typename T>
   inline hb_sanitize_with_object_t (hb_sanitize_context_t *c,
 				    const T& obj) : c (c)
   {
@@ -490,7 +490,7 @@ struct hb_sanitize_with_object_t
   }
   inline ~hb_sanitize_with_object_t (void)
   {
-    c->set_object ();
+    c->reset_object ();
   }
 
   private:


More information about the HarfBuzz mailing list