X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fkeyword.cc;h=b5f7947ada203e31550ee041a557f37f439b115c;hb=90e4d7057f3857da049dfda3d130017d4719bd6b;hp=7279ba52911626574f743e588394492c048f1139;hpb=767e42120b317f7ab2ca3e7a079bc4c2a0f7a776;p=lilypond.git diff --git a/lily/keyword.cc b/lily/keyword.cc index 7279ba5291..b5f7947ada 100644 --- a/lily/keyword.cc +++ b/lily/keyword.cc @@ -9,9 +9,9 @@ using namespace std; /* for qsort */ -int tabcmp (Keyword_ent const &p1, Keyword_ent const &p2) +bool tab_less (Keyword_ent const &p1, Keyword_ent const &p2) { - return strcmp (p1.name_, p2.name_); + return strcmp (p1.name_, p2.name_) < 0; } Keyword_table::Keyword_table (Keyword_ent *tab) @@ -19,7 +19,7 @@ Keyword_table::Keyword_table (Keyword_ent *tab) while (tab->name_) table_.push_back (*tab++); - vector_sort (table_, tabcmp); + vector_sort (table_, tab_less); } vsize @@ -27,9 +27,8 @@ Keyword_table::lookup (char const *s) const { Keyword_ent e; e.name_ = s; - vsize idx = binary_search (table_, e, tabcmp); + vsize idx = binary_search (table_, e, tab_less); if (idx != VPOS) return table_[idx].tokcode_; - else - return VPOS; + return VPOS; }