[Kde-bindings] KDE/kdebindings/smoke

Richard Dale Richard_Dale at tipitina.demon.co.uk
Thu Dec 11 15:47:05 UTC 2008


SVN commit 895737 by rdale:

* Initialize the lower bounds of the binary search methods to 1, as that 
  is where the first real entries are.
* Removed the tests for null string arguments passed to the search methods
  as it makes more sense not to pass them in the first place.

CCMAIL: kde-bindings at kde.org



 M  +4 -10     smoke.h  


--- trunk/KDE/kdebindings/smoke/smoke.h #895736:895737
@@ -319,15 +319,13 @@
     }
 
     inline Index idType(const char *t) {
-        if (!t) return 0;
         Index imax = numTypes;
-        Index imin = 0;
+        Index imin = 1;
         Index icur = -1;
         int icmp = -1;
 
         while (imax >= imin) {
             icur = (imin + imax) / 2;
-            if (!icur) return 0;
             icmp = strcmp(types[icur].name, t);
             if (icmp == 0) {
                 return icur;
@@ -344,15 +342,13 @@
     }
 
     inline ModuleIndex idClass(const char *c, bool external = false) {
-        if (!c) return NullModuleIndex;
         Index imax = numClasses;
-        Index imin = 0;
+        Index imin = 1;
         Index icur = -1;
         int icmp = -1;
 
         while (imax >= imin) {
             icur = (imin + imax) / 2;
-            if (!icur) return NullModuleIndex;
             icmp = strcmp(classes[icur].className, c);
             if (icmp == 0) {
                 if (classes[icur].external && !external) {
@@ -380,9 +376,8 @@
     }
 
     inline ModuleIndex idMethodName(const char *m) {
-        if (!m) return NullModuleIndex;
         Index imax = numMethodNames;
-        Index imin = 0;
+        Index imin = 1;
         Index icur = -1;
         int icmp = -1;
 
@@ -424,13 +419,12 @@
 
     inline ModuleIndex idMethod(Index c, Index name) {
         Index imax = numMethodMaps;
-        Index imin = 0;
+        Index imin = 1;
         Index icur = -1;
         int icmp = -1;
 
         while (imax >= imin) {
             icur = (imin + imax) / 2;
-            if (!icur) return NullModuleIndex;
             icmp = leg(methodMaps[icur].classId, c);
             if (icmp == 0) {
                 icmp = leg(methodMaps[icur].name, name);



More information about the Kde-bindings mailing list