Rename sort() to qsort()

In an effort to make the algorithm used clear.
This commit is contained in:
Behdad Esfahbod 2014-06-19 15:30:18 -04:00
parent 577ca48143
commit fb8cc86ff9
4 changed files with 10 additions and 10 deletions

View File

@ -477,7 +477,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
event->start = false; event->start = false;
event->feature = feature; event->feature = feature;
} }
feature_events.sort (); feature_events.qsort ();
/* Add a strategic final event. */ /* Add a strategic final event. */
{ {
active_feature_t feature; active_feature_t feature;
@ -512,7 +512,7 @@ _hb_coretext_shape (hb_shape_plan_t *shape_plan,
CFMutableArrayRef features_array = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks); CFMutableArrayRef features_array = CFArrayCreateMutable(kCFAllocatorDefault, 0, &kCFTypeArrayCallBacks);
/* TODO sort and resolve conflicting features? */ /* TODO sort and resolve conflicting features? */
/* active_features.sort (); */ /* active_features.qsort (); */
for (unsigned int j = 0; j < active_features.len; j++) for (unsigned int j = 0; j < active_features.len; j++)
{ {
CFStringRef keys[2] = { CFStringRef keys[2] = {

View File

@ -141,7 +141,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m)
/* Sort features and merge duplicates */ /* Sort features and merge duplicates */
{ {
feature_infos.sort (); feature_infos.qsort ();
unsigned int j = 0; unsigned int j = 0;
for (unsigned int i = 1; i < feature_infos.len; i++) for (unsigned int i = 1; i < feature_infos.len; i++)
if (feature_infos[i].tag != feature_infos[j].tag) if (feature_infos[i].tag != feature_infos[j].tag)
@ -251,7 +251,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m)
/* Sort lookups and merge duplicates */ /* Sort lookups and merge duplicates */
if (last_num_lookups < m.lookups[table_index].len) if (last_num_lookups < m.lookups[table_index].len)
{ {
m.lookups[table_index].sort (last_num_lookups, m.lookups[table_index].len); m.lookups[table_index].qsort (last_num_lookups, m.lookups[table_index].len);
unsigned int j = last_num_lookups; unsigned int j = last_num_lookups;
for (unsigned int i = j + 1; i < m.lookups[table_index].len; i++) for (unsigned int i = j + 1; i < m.lookups[table_index].len; i++)

View File

@ -353,14 +353,14 @@ struct hb_prealloced_array_t
return NULL; return NULL;
} }
inline void sort (void) inline void qsort (void)
{ {
qsort (array, len, sizeof (Type), (hb_compare_func_t) Type::cmp); ::qsort (array, len, sizeof (Type), (hb_compare_func_t) Type::cmp);
} }
inline void sort (unsigned int start, unsigned int end) inline void qsort (unsigned int start, unsigned int end)
{ {
qsort (array + start, end - start, sizeof (Type), (hb_compare_func_t) Type::cmp); ::qsort (array + start, end - start, sizeof (Type), (hb_compare_func_t) Type::cmp);
} }
template <typename T> template <typename T>

View File

@ -631,7 +631,7 @@ _hb_uniscribe_shape (hb_shape_plan_t *shape_plan,
event->start = false; event->start = false;
event->feature = feature; event->feature = feature;
} }
feature_events.sort (); feature_events.qsort ();
/* Add a strategic final event. */ /* Add a strategic final event. */
{ {
active_feature_t feature; active_feature_t feature;
@ -663,7 +663,7 @@ _hb_uniscribe_shape (hb_shape_plan_t *shape_plan,
unsigned int offset = feature_records.len; unsigned int offset = feature_records.len;
active_features.sort (); active_features.qsort ();
for (unsigned int j = 0; j < active_features.len; j++) for (unsigned int j = 0; j < active_features.len; j++)
{ {
if (!j || active_features[j].rec.tagFeature != feature_records[feature_records.len - 1].tagFeature) if (!j || active_features[j].rec.tagFeature != feature_records[feature_records.len - 1].tagFeature)