]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_utils.C
Hopefully fix the problem with stateText() in lyxfont.C
[lyx.git] / src / mathed / math_utils.C
index 90fb3bc5c3beab99ba19f8c024c4ed9c2869fee1..0d9c61c1e4bfaebdf630ea4e514bda72888cdb9a 100644 (file)
@@ -4,7 +4,7 @@
  *  Author:      Alejandro Aguilar Sierra <asierra@servidor.unam.mx> 
  *  Created:     August 1996
  *  
- *  Copyright: (c) 1996, 1997 Alejandro Aguilar Sierra
+ *  Copyright: 1996, 1997 Alejandro Aguilar Sierra
  *
  *  License: GNU GPL version 2 or later
  */
@@ -65,11 +65,13 @@ binary_op_pair binary_op_table[] = {
 
 struct compara {
        // used by sort
+       inline
        int operator()(binary_op_pair const & a,
                       binary_op_pair const & b) const {
                return a.id < b.id;
        }
        // used by lower_bound
+       inline
        int operator()(binary_op_pair const & a, short int id) const {
                return a.id < id;
        }
@@ -78,7 +80,8 @@ struct compara {
 
 int MathedLookupBOP(short id)
 {
-       static int bopCount = sizeof(binary_op_table) / sizeof(binary_op_pair);
+       static int const bopCount =
+               sizeof(binary_op_table) / sizeof(binary_op_pair);
        static bool issorted = false;
        
        if (!issorted) {
@@ -86,11 +89,11 @@ int MathedLookupBOP(short id)
                issorted = true;
        }
        
-       int result = 0;
        binary_op_pair * res = lower_bound(binary_op_table,
                                           binary_op_table + bopCount,
                                           id, compara());
-       if (res != (binary_op_table + bopCount))
-               result = res->isrel;
-       return result;
+       if (res != binary_op_table + bopCount && res->id == id)
+               return res->isrel;
+       else
+               return LMB_NONE;
 }