[vector] Use Crap pool in push() as well
diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 84cc22f..61f9c35 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -670,15 +670,11 @@
feature_event_t *event;
event = feature_events.push ();
- if (unlikely (!event))
- goto fail_features;
event->index = features[i].start;
event->start = true;
event->feature = feature;
event = feature_events.push ();
- if (unlikely (!event))
- goto fail_features;
event->index = features[i].end;
event->start = false;
event->feature = feature;
@@ -692,8 +688,6 @@
feature.order = num_features + 1;
feature_event_t *event = feature_events.push ();
- if (unlikely (!event))
- goto fail_features;
event->index = 0; /* This value does magic. */
event->start = false;
event->feature = feature;
@@ -710,8 +704,6 @@
{
/* Save a snapshot of active features and the range. */
range_record_t *range = range_records.push ();
- if (unlikely (!range))
- goto fail_features;
if (active_features.len)
{
@@ -769,10 +761,9 @@
last_index = event->index;
}
- if (event->start) {
- active_feature_t *feature = active_features.push (event->feature);
- if (unlikely (!feature))
- goto fail_features;
+ if (event->start)
+ {
+ active_features.push (event->feature);
} else {
active_feature_t *feature = active_features.find (&event->feature);
if (feature)
@@ -780,11 +771,6 @@
}
}
}
- else
- {
- fail_features:
- num_features = 0;
- }
unsigned int scratch_size;
hb_buffer_t::scratch_buffer_t *scratch = buffer->get_scratch_buffer (&scratch_size);
diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh
index 731aa41..c1903f6 100644
--- a/src/hb-ot-cmap-table.hh
+++ b/src/hb-ot-cmap-table.hh
@@ -211,7 +211,8 @@
}
// There must be a final entry with end_code == 0xFFFF. Check if we need to add one.
- if (segment == nullptr || segment->end_code != 0xFFFF) {
+ if (segment == nullptr || segment->end_code != 0xFFFF)
+ {
segment = segments->push ();
segment->start_code.set (0xFFFF);
segment->end_code.set (0xFFFF);
diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc
index adb0053..8d1471a 100644
--- a/src/hb-ot-layout.cc
+++ b/src/hb-ot-layout.cc
@@ -1099,8 +1099,7 @@
inline return_t dispatch (const T &obj)
{
hb_applicable_t *entry = array.push();
- if (likely (entry))
- entry->init (&obj, apply_to<T>);
+ entry->init (&obj, apply_to<T>);
return HB_VOID;
}
static return_t default_return_value (void) { return HB_VOID; }
diff --git a/src/hb-ot-map.cc b/src/hb-ot-map.cc
index b7cbafa..504f094 100644
--- a/src/hb-ot-map.cc
+++ b/src/hb-ot-map.cc
@@ -67,7 +67,6 @@
hb_ot_map_feature_flags_t flags)
{
feature_info_t *info = feature_infos.push();
- if (unlikely (!info)) return;
if (unlikely (!tag)) return;
info->tag = tag;
info->seq = feature_infos.len;
@@ -108,8 +107,6 @@
if (lookup_indices[i] >= table_lookup_count)
continue;
hb_ot_map_t::lookup_map_t *lookup = m.lookups[table_index].push ();
- if (unlikely (!lookup))
- return;
lookup->mask = mask;
lookup->index = lookup_indices[i];
lookup->auto_zwnj = auto_zwnj;
@@ -124,10 +121,8 @@
void hb_ot_map_builder_t::add_pause (unsigned int table_index, hb_ot_map_t::pause_func_t pause_func)
{
stage_info_t *s = stages[table_index].push ();
- if (likely (s)) {
- s->index = current_stage[table_index];
- s->pause_func = pause_func;
- }
+ s->index = current_stage[table_index];
+ s->pause_func = pause_func;
current_stage[table_index]++;
}
@@ -238,8 +233,6 @@
hb_ot_map_t::feature_map_t *map = m.features.push ();
- if (unlikely (!map))
- break;
map->tag = info->tag;
map->index[0] = feature_index[0];
@@ -321,10 +314,8 @@
if (stage_index < stages[table_index].len && stages[table_index][stage_index].index == stage) {
hb_ot_map_t::stage_map_t *stage_map = m.stages[table_index].push ();
- if (likely (stage_map)) {
- stage_map->last_lookup = last_num_lookups;
- stage_map->pause_func = stages[table_index][stage_index].pause_func;
- }
+ stage_map->last_lookup = last_num_lookups;
+ stage_map->pause_func = stages[table_index][stage_index].pause_func;
stage_index++;
}
diff --git a/src/hb-ot-post-table.hh b/src/hb-ot-post-table.hh
index 2762eb5..ab3c053 100644
--- a/src/hb-ot-post-table.hh
+++ b/src/hb-ot-post-table.hh
@@ -125,11 +125,7 @@
const uint8_t *end = (uint8_t *) table + table_length;
for (const uint8_t *data = pool; data < end && data + *data <= end; data += 1 + *data)
- {
- uint32_t *offset = index_to_offset.push (data - pool);
- if (unlikely (!offset))
- break;
- }
+ index_to_offset.push (data - pool);
}
inline void fini (void)
{
diff --git a/src/hb-private.hh b/src/hb-private.hh
index 6fee049..cdb6c30 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -658,17 +658,14 @@
inline Type *push (void)
{
if (unlikely (!resize (len + 1)))
- return nullptr;
-
+ return &Crap(Type);
return &arrayZ[len - 1];
}
inline Type *push (const Type& v)
{
- if (unlikely (!resize (len + 1)))
- return nullptr;
-
- arrayZ[len - 1] = v;
- return &arrayZ[len - 1];
+ Type *p = push ();
+ *p = v;
+ return p;
}
/* Allocate for size but don't adjust len. */
diff --git a/src/hb-subset-plan.cc b/src/hb-subset-plan.cc
index 97ff14c..7100efc 100644
--- a/src/hb-subset-plan.cc
+++ b/src/hb-subset-plan.cc
@@ -97,9 +97,7 @@
glyphs->alloc (all_gids_to_retain->get_population ());
gid = HB_SET_VALUE_INVALID;
while (all_gids_to_retain->next (&gid))
- {
glyphs->push (gid);
- }
hb_set_destroy (all_gids_to_retain);
glyf.fini ();
diff --git a/src/hb-subset.cc b/src/hb-subset.cc
index d631fc7..4d2dc29 100644
--- a/src/hb-subset.cc
+++ b/src/hb-subset.cc
@@ -224,8 +224,6 @@
hb_subset_face_data_t *data = (hb_subset_face_data_t *) face->user_data;
hb_subset_face_data_t::table_entry_t *entry = data->tables.push ();
- if (unlikely (!entry))
- return false;
entry->tag = tag;
entry->blob = hb_blob_reference (blob);
diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc
index 3b52ad3..6d6afe8 100644
--- a/src/hb-uniscribe.cc
+++ b/src/hb-uniscribe.cc
@@ -646,15 +646,11 @@
feature_event_t *event;
event = feature_events.push ();
- if (unlikely (!event))
- goto fail_features;
event->index = features[i].start;
event->start = true;
event->feature = feature;
event = feature_events.push ();
- if (unlikely (!event))
- goto fail_features;
event->index = features[i].end;
event->start = false;
event->feature = feature;
@@ -668,8 +664,6 @@
feature.order = num_features + 1;
feature_event_t *event = feature_events.push ();
- if (unlikely (!event))
- goto fail_features;
event->index = 0; /* This value does magic. */
event->start = false;
event->feature = feature;
@@ -686,8 +680,6 @@
{
/* Save a snapshot of active features and the range. */
range_record_t *range = range_records.push ();
- if (unlikely (!range))
- goto fail_features;
unsigned int offset = feature_records.len;
@@ -696,8 +688,7 @@
{
if (!j || active_features[j].rec.tagFeature != feature_records[feature_records.len - 1].tagFeature)
{
- if (unlikely (!feature_records.push (active_features[j].rec)))
- goto fail_features;
+ feature_records.push (active_features[j].rec);
}
else
{
@@ -716,10 +707,12 @@
last_index = event->index;
}
- if (event->start) {
- if (unlikely (!active_features.push (event->feature)))
- goto fail_features;
- } else {
+ if (event->start)
+ {
+ active_features.push (event->feature);
+ }
+ else
+ {
active_feature_t *feature = active_features.find (&event->feature);
if (feature)
active_features.remove (feature - active_features.arrayZ);
@@ -727,7 +720,7 @@
}
if (!range_records.len) /* No active feature found. */
- goto fail_features;
+ num_features = 0;
/* Fixup the pointers. */
for (unsigned int i = 0; i < range_records.len; i++)
@@ -736,11 +729,6 @@
range->props.potfRecords = feature_records.arrayZ + reinterpret_cast<uintptr_t> (range->props.potfRecords);
}
}
- else
- {
- fail_features:
- num_features = 0;
- }
#define FAIL(...) \
HB_STMT_START { \