mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-23 16:01:07 +01:00
Remove extra inline from static methods (#6582)
* Remove extra `inline` from static methods Just being defined inside a struct is enough to make them inline. * Add `inline` to hb-cff-specializer.hh functions Discovered while writing a custom code having the header included.
This commit is contained in:
1 parent
9644ff2a0f
commit
4ed682d5ce
13 files changed
+63
-71
No files matched your search
@@ -72,7 +72,7 @@ struct MarkBasePosFormat1_2
|
||||
|
||||
const Coverage &get_coverage () const { return this+markCoverage; }
|
||||
|
||||
static inline bool accept (hb_buffer_t *buffer, unsigned idx)
|
||||
static bool accept (hb_buffer_t *buffer, unsigned idx)
|
||||
{
|
||||
/* We only want to attach to the first of a MultipleSubst sequence.
|
||||
* https://github.com/harfbuzz/harfbuzz/issues/740
|
||||
|
||||
@@ -70,7 +70,7 @@ struct MarkLigPosFormat1_2
|
||||
|
||||
const Coverage &get_coverage () const { return this+markCoverage; }
|
||||
|
||||
static inline bool accept (hb_buffer_t *buffer, unsigned idx)
|
||||
static bool accept (hb_buffer_t *buffer, unsigned idx)
|
||||
{
|
||||
/* We only want to attach to the first of a MultipleSubst sequence,
|
||||
* which might have been ligated into a preceding ligature, and in that
|
||||
|
||||
@@ -322,18 +322,14 @@ struct ValueFormat : HBUINT16
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline Offset16To<Device, ValueBase>& get_device (Value* value)
|
||||
{
|
||||
return *static_cast<Offset16To<Device, ValueBase> *> (value);
|
||||
}
|
||||
static inline const Offset16To<Device, ValueBase>& get_device (const Value* value)
|
||||
{
|
||||
return *static_cast<const Offset16To<Device, ValueBase> *> (value);
|
||||
}
|
||||
static inline const Device& get_device (const Value* value,
|
||||
bool *worked,
|
||||
const ValueBase *base,
|
||||
hb_sanitize_context_t &c)
|
||||
static Offset16To<Device, ValueBase>& get_device (Value* value)
|
||||
{ return *static_cast<Offset16To<Device, ValueBase> *> (value); }
|
||||
static const Offset16To<Device, ValueBase>& get_device (const Value* value)
|
||||
{ return *static_cast<const Offset16To<Device, ValueBase> *> (value); }
|
||||
static const Device& get_device (const Value* value,
|
||||
bool *worked,
|
||||
const ValueBase *base,
|
||||
hb_sanitize_context_t &c)
|
||||
{
|
||||
if (worked) *worked |= bool (*value);
|
||||
auto &offset = *static_cast<const Offset16To<Device> *> (value);
|
||||
@@ -386,7 +382,7 @@ struct ValueFormat : HBUINT16
|
||||
}
|
||||
}
|
||||
|
||||
static inline const HBINT16& get_short (const Value* value, bool *worked=nullptr)
|
||||
static const HBINT16& get_short (const Value* value, bool *worked=nullptr)
|
||||
{
|
||||
if (worked) *worked |= bool (*value);
|
||||
return *reinterpret_cast<const HBINT16 *> (value);
|
||||
|
||||
@@ -18,7 +18,7 @@ struct SubstLookup : Lookup
|
||||
const SubTable& get_subtable (unsigned int i) const
|
||||
{ return Lookup::get_subtable<SubTable> (i); }
|
||||
|
||||
static inline bool lookup_type_is_reverse (unsigned int lookup_type)
|
||||
static bool lookup_type_is_reverse (unsigned int lookup_type)
|
||||
{ return lookup_type == SubTable::ReverseChainSingle; }
|
||||
|
||||
bool is_reverse () const
|
||||
@@ -199,7 +199,7 @@ struct SubstLookup : Lookup
|
||||
static inline typename hb_closure_context_t::return_t closure_glyphs_recurse_func (hb_closure_context_t *c, unsigned lookup_index, hb_set_t *covered_seq_indices, unsigned seq_index, unsigned end_index);
|
||||
|
||||
|
||||
static inline hb_closure_context_t::return_t dispatch_closure_recurse_func (hb_closure_context_t *c, unsigned lookup_index, hb_set_t *covered_seq_indices, unsigned seq_index, unsigned end_index)
|
||||
static hb_closure_context_t::return_t dispatch_closure_recurse_func (hb_closure_context_t *c, unsigned lookup_index, hb_set_t *covered_seq_indices, unsigned seq_index, unsigned end_index)
|
||||
{
|
||||
if (!c->should_visit_lookup (lookup_index))
|
||||
return hb_empty_t ();
|
||||
@@ -216,7 +216,7 @@ struct SubstLookup : Lookup
|
||||
|
||||
static inline hb_depend_context_t::return_t depend_glyphs_recurse_func (hb_depend_context_t *c, unsigned lookup_index, hb_bit_page_t *covered_seq_indices, unsigned seq_index, unsigned end_index);
|
||||
|
||||
static inline hb_depend_context_t::return_t dispatch_depend_recurse_func (hb_depend_context_t *c, unsigned lookup_index, hb_bit_page_t *covered_seq_indices, unsigned seq_index, unsigned end_index)
|
||||
static hb_depend_context_t::return_t dispatch_depend_recurse_func (hb_depend_context_t *c, unsigned lookup_index, hb_bit_page_t *covered_seq_indices, unsigned seq_index, unsigned end_index)
|
||||
{
|
||||
return depend_glyphs_recurse_func (c, lookup_index, covered_seq_indices, seq_index, end_index);
|
||||
}
|
||||
|
||||
+2
-4
@@ -42,8 +42,7 @@ struct hb_vector_size_t
|
||||
elt_t& operator [] (unsigned int i) { return v[i]; }
|
||||
const elt_t& operator [] (unsigned int i) const { return v[i]; }
|
||||
|
||||
static inline constexpr unsigned len ()
|
||||
{ return byte_size / sizeof (elt_t); }
|
||||
static constexpr unsigned len () { return byte_size / sizeof (elt_t); }
|
||||
|
||||
void init0 ()
|
||||
{
|
||||
@@ -121,8 +120,7 @@ struct hb_bit_page_t
|
||||
|
||||
void dirty () { population = UINT_MAX; }
|
||||
|
||||
static inline constexpr unsigned len ()
|
||||
{ return vector_t::len (); }
|
||||
static constexpr unsigned len () { return vector_t::len (); }
|
||||
|
||||
operator bool () const { return !is_empty (); }
|
||||
bool is_empty () const
|
||||
|
||||
+1
-1
@@ -199,7 +199,7 @@ struct hb_bit_set_t
|
||||
|
||||
/* Duplicated here from hb-machinery.hh to avoid including it. */
|
||||
template<typename Type>
|
||||
static inline const Type& StructAtOffsetUnaligned(const void *P, unsigned int offset)
|
||||
static const Type& StructAtOffsetUnaligned(const void *P, unsigned int offset)
|
||||
{
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||
|
||||
+5
-5
@@ -103,7 +103,7 @@ struct hb_blob_t
|
||||
unsigned capacity;
|
||||
};
|
||||
|
||||
static inline void recycle_data_destroy (void *user_data)
|
||||
static void recycle_data_destroy (void *user_data)
|
||||
{
|
||||
auto *bd = (recycle_data_t *) user_data;
|
||||
hb_free (bd->buf);
|
||||
@@ -117,7 +117,7 @@ struct hb_blob_t
|
||||
* fails and a fresh buffer was allocated instead -- the caller
|
||||
* must hb_free() that buf after recycle_finalize() runs. Returns
|
||||
* nullptr on allocation failure. */
|
||||
static inline char *
|
||||
static char *
|
||||
recycle_acquire (hb_blob_t *recycled,
|
||||
unsigned needed,
|
||||
unsigned *out_capacity,
|
||||
@@ -162,7 +162,7 @@ struct hb_blob_t
|
||||
* If @recycled is one of our blobs, update and return it (cheap);
|
||||
* otherwise create a new blob. Pass @replaced_recycled_buf from
|
||||
* recycle_acquire(). */
|
||||
static inline hb_blob_t *
|
||||
static hb_blob_t *
|
||||
recycle_finalize (char *buf,
|
||||
unsigned capacity,
|
||||
unsigned length,
|
||||
@@ -200,7 +200,7 @@ struct hb_blob_t
|
||||
/* Discard @buf returned by recycle_acquire without committing to
|
||||
* a blob. Frees @buf if it was a fresh allocation; leaves any
|
||||
* recycled buffer untouched. */
|
||||
static inline void
|
||||
static void
|
||||
recycle_abort (char *buf, hb_blob_t *recycled)
|
||||
{
|
||||
if (!buf) return;
|
||||
@@ -216,7 +216,7 @@ struct hb_blob_t
|
||||
* encode. Destroys any previously stashed blob. Safe to call
|
||||
* with @blob = nullptr or the empty-singleton blob (treated as
|
||||
* "drop"). */
|
||||
static inline void
|
||||
static void
|
||||
recycle_stash (hb_blob_t **slot, hb_blob_t *blob)
|
||||
{
|
||||
hb_blob_destroy (*slot);
|
||||
|
||||
@@ -33,7 +33,7 @@ is_zero (const number_t &n)
|
||||
*
|
||||
* Based on fontTools.cffLib.specializer.generalizeCommands
|
||||
*/
|
||||
static void
|
||||
static inline void
|
||||
generalize_commands (hb_vector_t<cs_command_t> &commands)
|
||||
{
|
||||
hb_vector_t<cs_command_t> result;
|
||||
@@ -149,7 +149,7 @@ generalize_commands (hb_vector_t<cs_command_t> &commands)
|
||||
*
|
||||
* This ensures we never exceed stack depth while optimizing bytecode.
|
||||
*/
|
||||
static void
|
||||
static inline void
|
||||
specialize_commands (hb_vector_t<cs_command_t> &commands,
|
||||
unsigned maxstack = 48)
|
||||
{
|
||||
@@ -242,7 +242,7 @@ specialize_commands (hb_vector_t<cs_command_t> &commands,
|
||||
}
|
||||
|
||||
/* Encode commands back to binary CharString */
|
||||
static bool
|
||||
static inline bool
|
||||
encode_commands (const hb_vector_t<cs_command_t> &commands,
|
||||
str_buff_t &output)
|
||||
{
|
||||
|
||||
+1
-1
@@ -748,7 +748,7 @@ struct hb_range_iter_t :
|
||||
{ return v != o.v; }
|
||||
|
||||
private:
|
||||
static inline T end_for (T start, T end_, S step)
|
||||
static T end_for (T start, T end_, S step)
|
||||
{
|
||||
if (!step)
|
||||
return end_;
|
||||
|
||||
+2
-2
@@ -126,10 +126,10 @@ struct hb_hashmap_t
|
||||
|
||||
template <bool v = minus_one,
|
||||
hb_enable_if (v == false)>
|
||||
static inline const V& default_value () { return Null(V); };
|
||||
static const V& default_value () { return Null(V); };
|
||||
template <bool v = minus_one,
|
||||
hb_enable_if (v == true)>
|
||||
static inline const V& default_value ()
|
||||
static const V& default_value ()
|
||||
{
|
||||
static_assert (hb_is_same (V, hb_codepoint_t), "");
|
||||
return minus_1;
|
||||
|
||||
@@ -2490,7 +2490,7 @@ struct delta_row_encoding_t
|
||||
bool in_error () const
|
||||
{ return chars.in_error () || items.in_error (); }
|
||||
|
||||
static inline unsigned get_chars_overhead (unsigned num_columns)
|
||||
static unsigned get_chars_overhead (unsigned num_columns)
|
||||
{
|
||||
unsigned c = 4 + 6; // 4 bytes for LOffset, 6 bytes for VarData header
|
||||
return c + num_columns * 2;
|
||||
|
||||
@@ -1131,9 +1131,9 @@ struct hb_ot_apply_context_t :
|
||||
typedef return_t (*recurse_func_t) (hb_ot_apply_context_t *c, unsigned int lookup_index);
|
||||
|
||||
template <typename T>
|
||||
static inline auto apply_ (const T &obj, hb_ot_apply_context_t *c, hb_priority<1>) HB_RETURN (return_t, obj.apply (c, nullptr) )
|
||||
static auto apply_ (const T &obj, hb_ot_apply_context_t *c, hb_priority<1>) HB_RETURN (return_t, obj.apply (c, nullptr) )
|
||||
template <typename T>
|
||||
static inline auto apply_ (const T &obj, hb_ot_apply_context_t *c, hb_priority<0>) HB_RETURN (return_t, obj.apply (c) )
|
||||
static auto apply_ (const T &obj, hb_ot_apply_context_t *c, hb_priority<0>) HB_RETURN (return_t, obj.apply (c) )
|
||||
template <typename T>
|
||||
return_t dispatch (const T &obj) { return apply_(obj, this, hb_prioritize); }
|
||||
|
||||
@@ -1420,21 +1420,21 @@ struct hb_accelerate_subtables_context_t :
|
||||
hb_dispatch_context_t<hb_accelerate_subtables_context_t>
|
||||
{
|
||||
template <typename T>
|
||||
static inline auto collect_second_glyphs_ (const T &obj,
|
||||
hb_set_digest_t *digest,
|
||||
hb_priority<1>) HB_RETURN (void, obj.collect_second_glyphs (digest) )
|
||||
static auto collect_second_glyphs_ (const T &obj,
|
||||
hb_set_digest_t *digest,
|
||||
hb_priority<1>) HB_RETURN (void, obj.collect_second_glyphs (digest) )
|
||||
template <typename T>
|
||||
static inline void collect_second_glyphs_ (const T &obj HB_UNUSED,
|
||||
hb_set_digest_t *digest,
|
||||
hb_priority<0>)
|
||||
static void collect_second_glyphs_ (const T &obj HB_UNUSED,
|
||||
hb_set_digest_t *digest,
|
||||
hb_priority<0>)
|
||||
{ *digest = hb_set_digest_t::full (); }
|
||||
|
||||
template <typename T>
|
||||
static inline auto apply_ (const T *obj, hb_ot_apply_context_t *c, void *external_cache, hb_priority<1>) HB_RETURN (bool, obj->apply (c, external_cache) )
|
||||
static auto apply_ (const T *obj, hb_ot_apply_context_t *c, void *external_cache, hb_priority<1>) HB_RETURN (bool, obj->apply (c, external_cache) )
|
||||
template <typename T>
|
||||
static inline auto apply_ (const T *obj, hb_ot_apply_context_t *c, void *external_cache, hb_priority<0>) HB_RETURN (bool, obj->apply (c) )
|
||||
static auto apply_ (const T *obj, hb_ot_apply_context_t *c, void *external_cache, hb_priority<0>) HB_RETURN (bool, obj->apply (c) )
|
||||
template <typename T>
|
||||
static inline bool apply_to (const void *obj, hb_ot_apply_context_t *c, void *external_cache)
|
||||
static bool apply_to (const void *obj, hb_ot_apply_context_t *c, void *external_cache)
|
||||
{
|
||||
const T *typed_obj = (const T *) obj;
|
||||
return apply_ (typed_obj, c, external_cache, hb_prioritize);
|
||||
@@ -1442,32 +1442,30 @@ struct hb_accelerate_subtables_context_t :
|
||||
|
||||
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
|
||||
template <typename T>
|
||||
static inline auto apply_cached_ (const T *obj, hb_ot_apply_context_t *c, void *external_cache, hb_priority<2>) HB_RETURN (bool, obj->apply_cached (c, external_cache) )
|
||||
static auto apply_cached_ (const T *obj, hb_ot_apply_context_t *c, void *external_cache, hb_priority<2>) HB_RETURN (bool, obj->apply_cached (c, external_cache) )
|
||||
template <typename T>
|
||||
static inline auto apply_cached_ (const T *obj, hb_ot_apply_context_t *c, void *external_cache, hb_priority<1>) HB_RETURN (bool, obj->apply (c, external_cache) )
|
||||
static auto apply_cached_ (const T *obj, hb_ot_apply_context_t *c, void *external_cache, hb_priority<1>) HB_RETURN (bool, obj->apply (c, external_cache) )
|
||||
template <typename T>
|
||||
static inline auto apply_cached_ (const T *obj, hb_ot_apply_context_t *c, void *external_cache, hb_priority<0>) HB_RETURN (bool, obj->apply (c) )
|
||||
static auto apply_cached_ (const T *obj, hb_ot_apply_context_t *c, void *external_cache, hb_priority<0>) HB_RETURN (bool, obj->apply (c) )
|
||||
template <typename T>
|
||||
static inline bool apply_cached_to (const void *obj, hb_ot_apply_context_t *c, void *external_cache)
|
||||
static bool apply_cached_to (const void *obj, hb_ot_apply_context_t *c, void *external_cache)
|
||||
{
|
||||
const T *typed_obj = (const T *) obj;
|
||||
return apply_cached_ (typed_obj, c, external_cache, hb_prioritize);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static inline auto cache_func_ (hb_ot_apply_context_t *c,
|
||||
hb_ot_subtable_cache_op_t op,
|
||||
hb_priority<1>) HB_RETURN (bool, T::cache_func (c, op) )
|
||||
static auto cache_func_ (hb_ot_apply_context_t *c,
|
||||
hb_ot_subtable_cache_op_t op,
|
||||
hb_priority<1>) HB_RETURN (bool, T::cache_func (c, op) )
|
||||
template <typename T=void>
|
||||
static inline bool cache_func_ (hb_ot_apply_context_t *c,
|
||||
hb_ot_subtable_cache_op_t op HB_UNUSED,
|
||||
hb_priority<0>) { return false; }
|
||||
static bool cache_func_ (hb_ot_apply_context_t *c,
|
||||
hb_ot_subtable_cache_op_t op HB_UNUSED,
|
||||
hb_priority<0>) { return false; }
|
||||
template <typename Type>
|
||||
static inline bool cache_func_to (hb_ot_apply_context_t *c,
|
||||
hb_ot_subtable_cache_op_t op)
|
||||
{
|
||||
return cache_func_<Type> (c, op, hb_prioritize);
|
||||
}
|
||||
static bool cache_func_to (hb_ot_apply_context_t *c,
|
||||
hb_ot_subtable_cache_op_t op)
|
||||
{ return cache_func_<Type> (c, op, hb_prioritize); }
|
||||
#endif
|
||||
|
||||
typedef bool (*hb_apply_func_t) (const void *obj, hb_ot_apply_context_t *c, void *external_cache);
|
||||
|
||||
+10
-10
@@ -37,7 +37,7 @@ struct hb_utf8_t
|
||||
typedef uint8_t codepoint_t;
|
||||
static constexpr unsigned max_len = 4;
|
||||
|
||||
static inline const codepoint_t *
|
||||
static const codepoint_t *
|
||||
next (const codepoint_t *text,
|
||||
const codepoint_t *end,
|
||||
hb_codepoint_t *unicode,
|
||||
@@ -106,7 +106,7 @@ struct hb_utf8_t
|
||||
return text;
|
||||
}
|
||||
|
||||
static inline const codepoint_t *
|
||||
static const codepoint_t *
|
||||
prev (const codepoint_t *text,
|
||||
const codepoint_t *start,
|
||||
hb_codepoint_t *unicode,
|
||||
@@ -185,7 +185,7 @@ struct hb_utf16_xe_t
|
||||
typedef TCodepoint codepoint_t;
|
||||
static constexpr unsigned max_len = 2;
|
||||
|
||||
static inline const codepoint_t *
|
||||
static const codepoint_t *
|
||||
next (const codepoint_t *text,
|
||||
const codepoint_t *end,
|
||||
hb_codepoint_t *unicode,
|
||||
@@ -217,7 +217,7 @@ struct hb_utf16_xe_t
|
||||
return text;
|
||||
}
|
||||
|
||||
static inline const codepoint_t *
|
||||
static const codepoint_t *
|
||||
prev (const codepoint_t *text,
|
||||
const codepoint_t *start,
|
||||
hb_codepoint_t *unicode,
|
||||
@@ -294,7 +294,7 @@ struct hb_utf32_xe_t
|
||||
typedef TCodepoint codepoint_t;
|
||||
static constexpr unsigned max_len = 1;
|
||||
|
||||
static inline const TCodepoint *
|
||||
static const TCodepoint *
|
||||
next (const TCodepoint *text,
|
||||
const TCodepoint *end HB_UNUSED,
|
||||
hb_codepoint_t *unicode,
|
||||
@@ -306,7 +306,7 @@ struct hb_utf32_xe_t
|
||||
return text;
|
||||
}
|
||||
|
||||
static inline const TCodepoint *
|
||||
static const TCodepoint *
|
||||
prev (const TCodepoint *text,
|
||||
const TCodepoint *start HB_UNUSED,
|
||||
hb_codepoint_t *unicode,
|
||||
@@ -353,7 +353,7 @@ struct hb_latin1_t
|
||||
typedef uint8_t codepoint_t;
|
||||
static constexpr unsigned max_len = 1;
|
||||
|
||||
static inline const codepoint_t *
|
||||
static const codepoint_t *
|
||||
next (const codepoint_t *text,
|
||||
const codepoint_t *end HB_UNUSED,
|
||||
hb_codepoint_t *unicode,
|
||||
@@ -363,7 +363,7 @@ struct hb_latin1_t
|
||||
return text;
|
||||
}
|
||||
|
||||
static inline const codepoint_t *
|
||||
static const codepoint_t *
|
||||
prev (const codepoint_t *text,
|
||||
const codepoint_t *start HB_UNUSED,
|
||||
hb_codepoint_t *unicode,
|
||||
@@ -405,7 +405,7 @@ struct hb_ascii_t
|
||||
typedef uint8_t codepoint_t;
|
||||
static constexpr unsigned max_len = 1;
|
||||
|
||||
static inline const codepoint_t *
|
||||
static const codepoint_t *
|
||||
next (const codepoint_t *text,
|
||||
const codepoint_t *end HB_UNUSED,
|
||||
hb_codepoint_t *unicode,
|
||||
@@ -417,7 +417,7 @@ struct hb_ascii_t
|
||||
return text;
|
||||
}
|
||||
|
||||
static inline const codepoint_t *
|
||||
static const codepoint_t *
|
||||
prev (const codepoint_t *text,
|
||||
const codepoint_t *start HB_UNUSED,
|
||||
hb_codepoint_t *unicode,
|
||||
|
||||
Reference in new issue
Block a user