]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/keyword.cc
Release: bump Welcome versions.
[lilypond.git] / lily / keyword.cc
index 378ad4e1683cfc9057b185d5647ef153faace639..b5f7947ada203e31550ee041a557f37f439b115c 100644 (file)
@@ -6,31 +6,29 @@
 
 #include <cstring>
 #include <cstdlib>
+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)
 {
   while (tab->name_)
-    {
-      table_.push (*tab++);
-    }
+    table_.push_back (*tab++);
 
-  table_.sort (tabcmp);
+  vector_sort (table_, tab_less);
 }
 
-int
+vsize
 Keyword_table::lookup (char const *s) const
 {
   Keyword_ent e;
   e.name_ = s;
-  int idx = binary_search (table_, e, tabcmp);
-  if (idx >= 0)
+  vsize idx = binary_search (table_, e, tab_less);
+  if (idx != VPOS)
     return table_[idx].tokcode_;
-  else
-    return -1;
+  return VPOS;
 }