[HarfBuzz] harfbuzz: Branch 'master' - 3 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Tue May 8 10:02:46 UTC 2018
src/hb-open-type-private.hh | 25 +++++++++++--------------
src/hb-ot-kern-table.hh | 2 +-
src/hb-ot-layout-private.hh | 8 ++++----
src/hb-ot-layout.cc | 6 +++---
src/hb-ot-post-table.hh | 2 +-
5 files changed, 20 insertions(+), 23 deletions(-)
New commits:
commit 2a2e28e701319b4053a5c95f06c68f859e4ce99b
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue May 8 03:00:21 2018 -0700
Don't keep instance in hb_table_lazy_loader_t
diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index 28c36921..775cb390 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -1239,7 +1239,6 @@ struct hb_table_lazy_loader_t
{
face = face_;
blob = nullptr;
- instance = nullptr;
}
inline void fini (void)
@@ -1250,19 +1249,18 @@ struct hb_table_lazy_loader_t
inline const T* get (void) const
{
retry:
- T *p = (T *) hb_atomic_ptr_get (&instance);
- if (unlikely (!p))
+ hb_blob_t *blob_ = (hb_blob_t *) hb_atomic_ptr_get (&blob);
+ if (unlikely (!blob_))
{
- hb_blob_t *blob_ = OT::Sanitizer<T>().sanitize (face->reference_table (T::tableTag));
- p = const_cast<T *>(blob_->as<T> ());
- if (!hb_atomic_ptr_cmpexch (const_cast<T **>(&instance), nullptr, p))
+ blob_ = OT::Sanitizer<T>().sanitize (face->reference_table (T::tableTag));
+ if (!hb_atomic_ptr_cmpexch (&blob, nullptr, blob_))
{
hb_blob_destroy (blob_);
goto retry;
}
blob = blob_;
}
- return p;
+ return blob_->as<T> ();
}
inline const T* operator-> (void) const
@@ -1270,10 +1268,9 @@ struct hb_table_lazy_loader_t
return get();
}
+ private:
hb_face_t *face;
mutable hb_blob_t *blob;
- private:
- mutable T *instance;
};
commit 57bac8f6995fabbb98eb9824d822f370f9449488
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue May 8 02:55:20 2018 -0700
Rename
diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index e21bd458..28c36921 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -1181,7 +1181,7 @@ struct BinSearchArrayOf : SortedArrayOf<Type, BinSearchHeader> {};
/* Lazy struct and blob loaders. */
-/* Logic is shared between hb_lazy_loader_t and hb_lazy_table_loader_t */
+/* Logic is shared between hb_lazy_loader_t and hb_table_lazy_loader_t */
template <typename T>
struct hb_lazy_loader_t
{
@@ -1231,9 +1231,9 @@ struct hb_lazy_loader_t
T *instance;
};
-/* Logic is shared between hb_lazy_loader_t and hb_lazy_table_loader_t */
+/* Logic is shared between hb_lazy_loader_t and hb_table_lazy_loader_t */
template <typename T>
-struct hb_lazy_table_loader_t
+struct hb_table_lazy_loader_t
{
inline void init (hb_face_t *face_)
{
diff --git a/src/hb-ot-layout-private.hh b/src/hb-ot-layout-private.hh
index caef70b9..b2f974b8 100644
--- a/src/hb-ot-layout-private.hh
+++ b/src/hb-ot-layout-private.hh
@@ -172,10 +172,10 @@ struct hb_ot_layout_t
const struct OT::GPOS *gpos;
/* TODO Move the following out of this struct. */
- OT::hb_lazy_table_loader_t<struct OT::BASE> base;
- OT::hb_lazy_table_loader_t<struct OT::MATH> math;
- OT::hb_lazy_table_loader_t<struct OT::fvar> fvar;
- OT::hb_lazy_table_loader_t<struct OT::avar> avar;
+ OT::hb_table_lazy_loader_t<struct OT::BASE> base;
+ OT::hb_table_lazy_loader_t<struct OT::MATH> math;
+ OT::hb_table_lazy_loader_t<struct OT::fvar> fvar;
+ OT::hb_table_lazy_loader_t<struct OT::avar> avar;
unsigned int gsub_lookup_count;
unsigned int gpos_lookup_count;
commit 2a46a020fd2fa2fe99886ab06188db5f0fa37ad1
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Tue May 8 02:53:03 2018 -0700
Minor
diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index 8bc74169..e21bd458 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -186,7 +186,7 @@ struct hb_sanitize_context_t :
inline void start_processing (void)
{
this->start = hb_blob_get_data (this->blob, nullptr);
- this->end = this->start + hb_blob_get_length (this->blob);
+ this->end = this->start + this->blob->length;
assert (this->start <= this->end); /* Must not overflow. */
this->max_ops = MAX ((unsigned int) (this->end - this->start) * HB_SANITIZE_MAX_OPS_FACTOR,
(unsigned) HB_SANITIZE_MAX_OPS_MIN);
@@ -329,7 +329,7 @@ struct Sanitizer
unsigned int edit_count = c->edit_count;
if (edit_count && !c->writable) {
c->start = hb_blob_get_data_writable (blob, nullptr);
- c->end = c->start + hb_blob_get_length (blob);
+ c->end = c->start + blob->length;
if (c->start) {
c->writable = true;
diff --git a/src/hb-ot-kern-table.hh b/src/hb-ot-kern-table.hh
index 9366dbf4..b0fdea4a 100644
--- a/src/hb-ot-kern-table.hh
+++ b/src/hb-ot-kern-table.hh
@@ -364,7 +364,7 @@ struct kern
{
blob = Sanitizer<kern>().sanitize (face->reference_table (HB_OT_TAG_kern));
table = blob->as<kern> ();
- table_length = hb_blob_get_length (blob);
+ table_length = blob->length;
}
inline void fini (void)
{
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index d5efde29..368a8465 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -77,9 +77,9 @@ _hb_ot_layout_create (hb_face_t *face)
* See this thread for why we finally had to bend in and do this:
* https://lists.freedesktop.org/archives/harfbuzz/2016-February/005489.html
*/
- unsigned int gdef_len = hb_blob_get_length (layout->gdef_blob);
- unsigned int gsub_len = hb_blob_get_length (layout->gsub_blob);
- unsigned int gpos_len = hb_blob_get_length (layout->gpos_blob);
+ unsigned int gdef_len = layout->gdef_blob->length;
+ unsigned int gsub_len = layout->gsub_blob->length;
+ unsigned int gpos_len = layout->gpos_blob->length;
if (0
/* sha1sum:c5ee92f0bca4bfb7d06c4d03e8cf9f9cf75d2e8a Windows 7? timesi.ttf */
|| (442 == gdef_len && 42038 == gpos_len && 2874 == gsub_len)
diff --git a/src/hb-ot-post-table.hh b/src/hb-ot-post-table.hh
index bb5f9b31..8ba5ee10 100644
--- a/src/hb-ot-post-table.hh
+++ b/src/hb-ot-post-table.hh
@@ -111,7 +111,7 @@ struct post
{
blob = Sanitizer<post>().sanitize (face->reference_table (HB_OT_TAG_post));
const post *table = blob->as<post> ();
- unsigned int table_length = hb_blob_get_length (blob);
+ unsigned int table_length = blob->length;
version = table->version.to_int ();
index_to_offset.init ();
More information about the HarfBuzz
mailing list