Make the NullPool HB_INTERNAL shared
Saves 2k of .bss section.
This commit is contained in:
parent
7036f1d22c
commit
3205de7906
|
@ -130,14 +130,16 @@ static inline Type& StructAfter(TObject &X)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Global nul-content Null pool. Enlarge as necessary. */
|
/* Global nul-content Null pool. Enlarge as necessary. */
|
||||||
/* TODO This really should be a extern HB_INTERNAL and defined somewhere... */
|
|
||||||
static const void *_NullPool[(256+8) / sizeof (void *)];
|
#define HB_NULL_POOL_SIZE 264
|
||||||
|
static_assert (HB_NULL_POOL_SIZE % sizeof (void *) == 0, "Align HB_NULL_POOL_SIZE.");
|
||||||
|
extern HB_INTERNAL const void *_hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)];
|
||||||
|
|
||||||
/* Generic nul-content Null objects. */
|
/* Generic nul-content Null objects. */
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
static inline const Type& Null (void) {
|
static inline const Type& Null (void) {
|
||||||
static_assert ((sizeof (Type) <= sizeof (_NullPool)), "");
|
static_assert (sizeof (Type) <= HB_NULL_POOL_SIZE, "Increase HB_NULL_POOL_SIZE.");
|
||||||
return *CastP<Type> (_NullPool);
|
return *CastP<Type> (_hb_NullPool);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Specializaiton for arbitrary-content arbitrary-sized Null objects. */
|
/* Specializaiton for arbitrary-content arbitrary-sized Null objects. */
|
||||||
|
|
|
@ -39,6 +39,9 @@
|
||||||
#include "hb-ot-map-private.hh"
|
#include "hb-ot-map-private.hh"
|
||||||
|
|
||||||
|
|
||||||
|
const void *OT::_hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)];
|
||||||
|
|
||||||
|
|
||||||
hb_ot_layout_t *
|
hb_ot_layout_t *
|
||||||
_hb_ot_layout_create (hb_face_t *face)
|
_hb_ot_layout_create (hb_face_t *face)
|
||||||
{
|
{
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
using namespace OT;
|
using namespace OT;
|
||||||
|
|
||||||
|
const void *OT::_hb_NullPool[HB_NULL_POOL_SIZE / sizeof (void *)];
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
|
|
Loading…
Reference in New Issue