From: Behdad Esfahbod Date: Wed, 12 Dec 2018 02:18:47 +0000 (-0500) Subject: [serialize] Break down assert X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2aba2c6c73301396f7e0e5dee819ab6863e74900;p=platform%2Fupstream%2FlibHarfBuzzSharp.git [serialize] Break down assert --- diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh index 1732d29..906fad5 100644 --- a/src/hb-machinery.hh +++ b/src/hb-machinery.hh @@ -588,22 +588,20 @@ struct hb_serialize_context_t } template - inline Type *extend_min (Type &obj) + inline Type *extend_size (Type &obj, unsigned int size) { - unsigned int size = obj.min_size; - assert (this->start <= (char *) &obj && (char *) &obj <= this->head && (char *) &obj + size >= this->head); + assert (this->start <= (char *) &obj); + assert ((char *) &obj <= this->head); + assert ((char *) &obj + size >= this->head); if (unlikely (!this->allocate_size (((char *) &obj) + size - this->head))) return nullptr; return reinterpret_cast (&obj); } template - inline Type *extend (Type &obj) - { - unsigned int size = obj.get_size (); - assert (this->start < (char *) &obj && (char *) &obj <= this->head && (char *) &obj + size >= this->head); - if (unlikely (!this->allocate_size (((char *) &obj) + size - this->head))) return nullptr; - return reinterpret_cast (&obj); - } + inline Type *extend_min (Type &obj) { return extend_size (obj, obj.min_size); } + + template + inline Type *extend (Type &obj) { return extend_size (obj, obj.get_size ()); } /* Output routines. */ template