]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/keyword.cc
Fix some bugs in the dynamic engraver and PostScript backend
[lilypond.git] / lily / keyword.cc
index 418542cd2566237b3d9a254ff4969c7bb3e2751f..84065ab4f6fd0093f621e0d87d3a351b9f027ab3 100644 (file)
@@ -1,14 +1,15 @@
 /*
   keyword.cc -- keywords and identifiers
- */
+*/
 
 #include "keyword.hh"
 
 #include <cstring>
 #include <cstdlib>
+using namespace std;
 
 /* for qsort */
-int tabcmp (Keyword_ent  const &p1, Keyword_ent const &p2)
+int tabcmp (Keyword_ent const &p1, Keyword_ent const &p2)
 {
   return strcmp (p1.name_, p2.name_);
 }
@@ -16,21 +17,18 @@ int tabcmp (Keyword_ent  const &p1, Keyword_ent const &p2)
 Keyword_table::Keyword_table (Keyword_ent *tab)
 {
   while (tab->name_)
-    {
-      table_.push (*tab++);
-    }
+    table_.push_back (*tab++);
 
-  table_.sort (tabcmp);
+  vector_sort (table_, tabcmp);
 }
 
-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)
+  Keyword_ent e;
+  e.name_ = s;
+  vsize idx = binary_search (table_, e, tabcmp);
+  if (idx != VPOS)
     return table_[idx].tokcode_;
-  else
-    return -1;
+  return VPOS;
 }