Skip to content

Commit 09978fc

Browse files
committed
[ot] Rename hb_ot_lookup_cache_op_t, and cache to subtable_cache
1 parent a220479 commit 09978fc

File tree

4 files changed

+56
-56
lines changed

4 files changed

+56
-56
lines changed

src/OT/Layout/GPOS/PairPosFormat1.hh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,22 +107,22 @@ struct PairPosFormat1_3
107107
{
108108
return (this+coverage).cost ();
109109
}
110-
static void * cache_func (void *p, hb_ot_lookup_cache_op_t op)
110+
static void * cache_func (void *p, hb_ot_subtable_cache_op_t op)
111111
{
112112
switch (op)
113113
{
114-
case hb_ot_lookup_cache_op_t::CREATE:
114+
case hb_ot_subtable_cache_op_t::CREATE:
115115
{
116116
hb_ot_lookup_cache_t *cache = (hb_ot_lookup_cache_t *) hb_malloc (sizeof (hb_ot_lookup_cache_t));
117117
if (likely (cache))
118118
cache->clear ();
119119
return cache;
120120
}
121-
case hb_ot_lookup_cache_op_t::ENTER:
121+
case hb_ot_subtable_cache_op_t::ENTER:
122122
return (void *) true;
123-
case hb_ot_lookup_cache_op_t::LEAVE:
123+
case hb_ot_subtable_cache_op_t::LEAVE:
124124
return nullptr;
125-
case hb_ot_lookup_cache_op_t::DESTROY:
125+
case hb_ot_subtable_cache_op_t::DESTROY:
126126
{
127127
hb_ot_lookup_cache_t *cache = (hb_ot_lookup_cache_t *) p;
128128
hb_free (cache);
@@ -141,7 +141,7 @@ struct PairPosFormat1_3
141141
hb_buffer_t *buffer = c->buffer;
142142

143143
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
144-
hb_ot_lookup_cache_t *cache = cached ? (hb_ot_lookup_cache_t *) c->lookup_accel->cache : nullptr;
144+
hb_ot_lookup_cache_t *cache = cached ? (hb_ot_lookup_cache_t *) c->lookup_accel->subtable_cache : nullptr;
145145
unsigned int index = (this+coverage).get_coverage (buffer->cur().codepoint, cache);
146146
#else
147147
unsigned int index = (this+coverage).get_coverage (buffer->cur().codepoint);

src/OT/Layout/GPOS/PairPosFormat2.hh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,11 @@ struct PairPosFormat2_4 : ValueBase
134134
{
135135
return (this+coverage).cost () + (this+classDef1).cost () + (this+classDef2).cost ();
136136
}
137-
static void * cache_func (void *p, hb_ot_lookup_cache_op_t op)
137+
static void * cache_func (void *p, hb_ot_subtable_cache_op_t op)
138138
{
139139
switch (op)
140140
{
141-
case hb_ot_lookup_cache_op_t::CREATE:
141+
case hb_ot_subtable_cache_op_t::CREATE:
142142
{
143143
pair_pos_cache_t *cache = (pair_pos_cache_t *) hb_malloc (sizeof (pair_pos_cache_t));
144144
if (likely (cache))
@@ -149,11 +149,11 @@ struct PairPosFormat2_4 : ValueBase
149149
}
150150
return cache;
151151
}
152-
case hb_ot_lookup_cache_op_t::ENTER:
152+
case hb_ot_subtable_cache_op_t::ENTER:
153153
return (void *) true;
154-
case hb_ot_lookup_cache_op_t::LEAVE:
154+
case hb_ot_subtable_cache_op_t::LEAVE:
155155
return nullptr;
156-
case hb_ot_lookup_cache_op_t::DESTROY:
156+
case hb_ot_subtable_cache_op_t::DESTROY:
157157
{
158158
pair_pos_cache_t *cache = (pair_pos_cache_t *) p;
159159
hb_free (cache);
@@ -172,7 +172,7 @@ struct PairPosFormat2_4 : ValueBase
172172
hb_buffer_t *buffer = c->buffer;
173173

174174
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
175-
pair_pos_cache_t *cache = cached ? (pair_pos_cache_t *) c->lookup_accel->cache : nullptr;
175+
pair_pos_cache_t *cache = cached ? (pair_pos_cache_t *) c->lookup_accel->subtable_cache : nullptr;
176176
unsigned int index = (this+coverage).get_coverage (buffer->cur().codepoint, cache ? &cache->coverage : nullptr);
177177
#else
178178
unsigned int index = (this+coverage).get_coverage (buffer->cur().codepoint);

src/OT/Layout/GSUB/LigatureSubstFormat1.hh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,22 +82,22 @@ struct LigatureSubstFormat1_2
8282
{
8383
return (this+coverage).cost ();
8484
}
85-
static void * cache_func (void *p, hb_ot_lookup_cache_op_t op)
85+
static void * cache_func (void *p, hb_ot_subtable_cache_op_t op)
8686
{
8787
switch (op)
8888
{
89-
case hb_ot_lookup_cache_op_t::CREATE:
89+
case hb_ot_subtable_cache_op_t::CREATE:
9090
{
9191
hb_ot_lookup_cache_t *cache = (hb_ot_lookup_cache_t *) hb_malloc (sizeof (hb_ot_lookup_cache_t));
9292
if (likely (cache))
9393
cache->clear ();
9494
return cache;
9595
}
96-
case hb_ot_lookup_cache_op_t::ENTER:
96+
case hb_ot_subtable_cache_op_t::ENTER:
9797
return (void *) true;
98-
case hb_ot_lookup_cache_op_t::LEAVE:
98+
case hb_ot_subtable_cache_op_t::LEAVE:
9999
return nullptr;
100-
case hb_ot_lookup_cache_op_t::DESTROY:
100+
case hb_ot_subtable_cache_op_t::DESTROY:
101101
{
102102
hb_ot_lookup_cache_t *cache = (hb_ot_lookup_cache_t *) p;
103103
hb_free (cache);
@@ -115,7 +115,7 @@ struct LigatureSubstFormat1_2
115115
hb_buffer_t *buffer = c->buffer;
116116

117117
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
118-
hb_ot_lookup_cache_t *cache = cached ? (hb_ot_lookup_cache_t *) c->lookup_accel->cache : nullptr;
118+
hb_ot_lookup_cache_t *cache = cached ? (hb_ot_lookup_cache_t *) c->lookup_accel->subtable_cache : nullptr;
119119
unsigned int index = (this+coverage).get_coverage (buffer->cur().codepoint, cache);
120120
#else
121121
unsigned int index = (this+coverage).get_coverage (buffer->cur().codepoint);

src/hb-ot-layout-gsubgpos.hh

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ struct hb_ot_apply_context_t :
888888
}
889889
};
890890

891-
enum class hb_ot_lookup_cache_op_t
891+
enum class hb_ot_subtable_cache_op_t
892892
{
893893
CREATE,
894894
ENTER,
@@ -920,22 +920,22 @@ struct hb_accelerate_subtables_context_t :
920920

921921
template <typename T>
922922
static inline auto cache_func_ (void *p,
923-
hb_ot_lookup_cache_op_t op,
923+
hb_ot_subtable_cache_op_t op,
924924
hb_priority<1>) HB_RETURN (void *, T::cache_func (p, op) )
925925
template <typename T=void>
926926
static inline void * cache_func_ (void *p,
927-
hb_ot_lookup_cache_op_t op HB_UNUSED,
927+
hb_ot_subtable_cache_op_t op HB_UNUSED,
928928
hb_priority<0>) { return (void *) false; }
929929
template <typename Type>
930930
static inline void * cache_func_to (void *p,
931-
hb_ot_lookup_cache_op_t op)
931+
hb_ot_subtable_cache_op_t op)
932932
{
933933
return cache_func_<Type> (p, op, hb_prioritize);
934934
}
935935
#endif
936936

937937
typedef bool (*hb_apply_func_t) (const void *obj, hb_ot_apply_context_t *c);
938-
typedef void * (*hb_cache_func_t) (void *p, hb_ot_lookup_cache_op_t op);
938+
typedef void * (*hb_cache_func_t) (void *p, hb_ot_subtable_cache_op_t op);
939939

940940
struct hb_applicable_t
941941
{
@@ -972,11 +972,11 @@ struct hb_accelerate_subtables_context_t :
972972
}
973973
bool cache_enter (hb_ot_apply_context_t *c) const
974974
{
975-
return (bool) cache_func (c, hb_ot_lookup_cache_op_t::ENTER);
975+
return (bool) cache_func (c, hb_ot_subtable_cache_op_t::ENTER);
976976
}
977977
void cache_leave (hb_ot_apply_context_t *c) const
978978
{
979-
cache_func (c, hb_ot_lookup_cache_op_t::LEAVE);
979+
cache_func (c, hb_ot_subtable_cache_op_t::LEAVE);
980980
}
981981
#endif
982982

@@ -1021,10 +1021,10 @@ struct hb_accelerate_subtables_context_t :
10211021
* and we allocate the cache opportunity to the costliest subtable.
10221022
*/
10231023
unsigned cost = cache_cost (obj, hb_prioritize);
1024-
if (cost > cache_user_cost)
1024+
if (cost > subtable_cache_user_cost)
10251025
{
1026-
cache_user_idx = i - 1;
1027-
cache_user_cost = cost;
1026+
subtable_cache_user_idx = i - 1;
1027+
subtable_cache_user_cost = cost;
10281028
}
10291029
#endif
10301030

@@ -1039,8 +1039,8 @@ struct hb_accelerate_subtables_context_t :
10391039
unsigned i = 0;
10401040

10411041
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
1042-
unsigned cache_user_idx = (unsigned) -1;
1043-
unsigned cache_user_cost = 0;
1042+
unsigned subtable_cache_user_idx = (unsigned) -1;
1043+
unsigned subtable_cache_user_cost = 0;
10441044
#endif
10451045
};
10461046

@@ -2623,13 +2623,13 @@ struct ContextFormat2_5
26232623
unsigned c = (this+classDef).cost () * ruleSet.len;
26242624
return c >= 4 ? c : 0;
26252625
}
2626-
static void * cache_func (void *p, hb_ot_lookup_cache_op_t op)
2626+
static void * cache_func (void *p, hb_ot_subtable_cache_op_t op)
26272627
{
26282628
switch (op)
26292629
{
2630-
case hb_ot_lookup_cache_op_t::CREATE:
2630+
case hb_ot_subtable_cache_op_t::CREATE:
26312631
return (void *) true;
2632-
case hb_ot_lookup_cache_op_t::ENTER:
2632+
case hb_ot_subtable_cache_op_t::ENTER:
26332633
{
26342634
hb_ot_apply_context_t *c = (hb_ot_apply_context_t *) p;
26352635
if (!HB_BUFFER_TRY_ALLOCATE_VAR (c->buffer, syllable))
@@ -2641,14 +2641,14 @@ struct ContextFormat2_5
26412641
c->new_syllables = 255;
26422642
return (void *) true;
26432643
}
2644-
case hb_ot_lookup_cache_op_t::LEAVE:
2644+
case hb_ot_subtable_cache_op_t::LEAVE:
26452645
{
26462646
hb_ot_apply_context_t *c = (hb_ot_apply_context_t *) p;
26472647
c->new_syllables = (unsigned) -1;
26482648
HB_BUFFER_DEALLOCATE_VAR (c->buffer, syllable);
26492649
return nullptr;
26502650
}
2651-
case hb_ot_lookup_cache_op_t::DESTROY:
2651+
case hb_ot_subtable_cache_op_t::DESTROY:
26522652
return nullptr;
26532653
}
26542654
return nullptr;
@@ -3873,13 +3873,13 @@ struct ChainContextFormat2_5
38733873
{
38743874
return (this+lookaheadClassDef).cost () * ruleSet.len;
38753875
}
3876-
static void * cache_func (void *p, hb_ot_lookup_cache_op_t op)
3876+
static void * cache_func (void *p, hb_ot_subtable_cache_op_t op)
38773877
{
38783878
switch (op)
38793879
{
3880-
case hb_ot_lookup_cache_op_t::CREATE:
3880+
case hb_ot_subtable_cache_op_t::CREATE:
38813881
return (void *) true;
3882-
case hb_ot_lookup_cache_op_t::ENTER:
3882+
case hb_ot_subtable_cache_op_t::ENTER:
38833883
{
38843884
hb_ot_apply_context_t *c = (hb_ot_apply_context_t *) p;
38853885
if (!HB_BUFFER_TRY_ALLOCATE_VAR (c->buffer, syllable))
@@ -3891,14 +3891,14 @@ struct ChainContextFormat2_5
38913891
c->new_syllables = 255;
38923892
return (void *) true;
38933893
}
3894-
case hb_ot_lookup_cache_op_t::LEAVE:
3894+
case hb_ot_subtable_cache_op_t::LEAVE:
38953895
{
38963896
hb_ot_apply_context_t *c = (hb_ot_apply_context_t *) p;
38973897
c->new_syllables = (unsigned) -1;
38983898
HB_BUFFER_DEALLOCATE_VAR (c->buffer, syllable);
38993899
return nullptr;
39003900
}
3901-
case hb_ot_lookup_cache_op_t::DESTROY:
3901+
case hb_ot_subtable_cache_op_t::DESTROY:
39023902
return nullptr;
39033903
}
39043904
return nullptr;
@@ -4427,20 +4427,20 @@ struct hb_ot_layout_lookup_accelerator_t
44274427
thiz->digest.union_ (subtable.digest);
44284428

44294429
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
4430-
if (c_accelerate_subtables.cache_user_cost < 4)
4431-
c_accelerate_subtables.cache_user_idx = (unsigned) -1;
4430+
if (c_accelerate_subtables.subtable_cache_user_cost < 4)
4431+
c_accelerate_subtables.subtable_cache_user_idx = (unsigned) -1;
44324432

4433-
thiz->cache_user_idx = c_accelerate_subtables.cache_user_idx;
4433+
thiz->subtable_cache_user_idx = c_accelerate_subtables.subtable_cache_user_idx;
44344434

4435-
if (thiz->cache_user_idx != (unsigned) -1)
4435+
if (thiz->subtable_cache_user_idx != (unsigned) -1)
44364436
{
4437-
thiz->cache = thiz->subtables[thiz->cache_user_idx].cache_func (nullptr, hb_ot_lookup_cache_op_t::CREATE);
4438-
if (!thiz->cache)
4439-
thiz->cache_user_idx = (unsigned) -1;
4437+
thiz->subtable_cache = thiz->subtables[thiz->subtable_cache_user_idx].cache_func (nullptr, hb_ot_subtable_cache_op_t::CREATE);
4438+
if (!thiz->subtable_cache)
4439+
thiz->subtable_cache_user_idx = (unsigned) -1;
44404440
}
44414441

44424442
for (unsigned i = 0; i < count; i++)
4443-
if (i != thiz->cache_user_idx)
4443+
if (i != thiz->subtable_cache_user_idx)
44444444
thiz->subtables[i].apply_cached_func = thiz->subtables[i].apply_func;
44454445
#endif
44464446

@@ -4450,10 +4450,10 @@ struct hb_ot_layout_lookup_accelerator_t
44504450
void fini ()
44514451
{
44524452
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
4453-
if (cache)
4453+
if (subtable_cache)
44544454
{
4455-
assert (cache_user_idx != (unsigned) -1);
4456-
subtables[cache_user_idx].cache_func (cache, hb_ot_lookup_cache_op_t::DESTROY);
4455+
assert (subtable_cache_user_idx != (unsigned) -1);
4456+
subtables[subtable_cache_user_idx].cache_func (subtable_cache, hb_ot_subtable_cache_op_t::DESTROY);
44574457
}
44584458
#endif
44594459
}
@@ -4491,26 +4491,26 @@ struct hb_ot_layout_lookup_accelerator_t
44914491
bool cache_enter (hb_ot_apply_context_t *c) const
44924492
{
44934493
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
4494-
return cache_user_idx != (unsigned) -1 &&
4495-
subtables[cache_user_idx].cache_enter (c);
4494+
return subtable_cache_user_idx != (unsigned) -1 &&
4495+
subtables[subtable_cache_user_idx].cache_enter (c);
44964496
#else
44974497
return false;
44984498
#endif
44994499
}
45004500
void cache_leave (hb_ot_apply_context_t *c) const
45014501
{
45024502
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
4503-
subtables[cache_user_idx].cache_leave (c);
4503+
subtables[subtable_cache_user_idx].cache_leave (c);
45044504
#endif
45054505
}
45064506

45074507

45084508
hb_set_digest_t digest;
45094509
#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
45104510
public:
4511-
void *cache = nullptr;
4511+
void *subtable_cache = nullptr;
45124512
private:
4513-
unsigned cache_user_idx = (unsigned) -1;
4513+
unsigned subtable_cache_user_idx = (unsigned) -1;
45144514
#endif
45154515
private:
45164516
hb_accelerate_subtables_context_t::hb_applicable_t subtables[HB_VAR_ARRAY];

0 commit comments

Comments
 (0)