[serialize] Add more function attributes

pull/4264/head
Behdad Esfahbod 1 year ago
parent aad12ca649
commit 15048e50ec
  1. 2
      src/OT/glyf/SubsetGlyph.hh
  2. 6
      src/hb-serialize.hh

@ -40,7 +40,7 @@ struct SubsetGlyph
pad = 0;
while (pad_length > 0)
{
c->embed (pad);
(void) c->embed (pad);
pad_length--;
}

@ -573,11 +573,11 @@ struct hb_serialize_context_t
}
template <typename Type = void>
__attribute__((malloc, returns_nonnull))
__attribute__((returns_nonnull))
Type *start_embed (const Type *obj HB_UNUSED = nullptr) const
{ return reinterpret_cast<Type *> (this->head); }
template <typename Type>
__attribute__((malloc, returns_nonnull))
__attribute__((returns_nonnull))
Type *start_embed (const Type &obj) const
{ return start_embed (std::addressof (obj)); }
@ -626,6 +626,7 @@ struct hb_serialize_context_t
{ return this->allocate_size<Type> (Type::min_size); }
template <typename Type>
HB_NODISCARD __attribute__((malloc))
Type *embed (const Type *obj)
{
unsigned int size = obj->get_size ();
@ -635,6 +636,7 @@ struct hb_serialize_context_t
return ret;
}
template <typename Type>
HB_NODISCARD __attribute__((malloc))
Type *embed (const Type &obj)
{ return embed (std::addressof (obj)); }
char *embed (const char *obj, unsigned size)

Loading…
Cancel
Save