Revision: 71148
          http://sourceforge.net/p/brlcad/code/71148
Author:   sharannyn
Date:     2018-07-11 07:36:24 +0000 (Wed, 11 Jul 2018)
Log Message:
-----------
Returning GED_ERROR is wrong; Any non-negative return value acts as an index to 
the obj_tbl array

Modified Paths:
--------------
    brlcad/trunk/src/libged/gqa.c

Modified: brlcad/trunk/src/libged/gqa.c
===================================================================
--- brlcad/trunk/src/libged/gqa.c       2018-07-11 07:29:08 UTC (rev 71147)
+++ brlcad/trunk/src/libged/gqa.c       2018-07-11 07:36:24 UTC (rev 71148)
@@ -1460,10 +1460,7 @@
 
     bu_vls_printf(_ged_current_gedp->ged_result_str, "%s Didn't find object 
named \"%s\" in %d entries\n", CPP_FILELINE, name, num_objects);
 
-    /* FIXME: this is wrong.  GED_ERROR is not the same "type" as i
-     *  .. and could very well be a valid index (it is).
-     */
-    return GED_ERROR;
+    return -1;
 }
 
 
@@ -1478,6 +1475,7 @@
     struct rt_i *rtip = state->rtip;
     int i;
     int m;
+    int index;
 
     if (start > ac) {
        /* what? */
@@ -1541,8 +1539,11 @@
 
        m = (int)strlen(regp->reg_name);
        if (m > max_region_name_len) max_region_name_len = m;
-       reg_tbl[i].optr = &obj_tbl[ find_cmd_line_obj(obj_tbl, 
&regp->reg_name[1]) ];
-
+       index = find_cmd_line_obj(obj_tbl, &regp->reg_name[1]);
+       if (index == -1)
+           reg_tbl[i].optr = NULL;
+       else
+           reg_tbl[i].optr = &obj_tbl[index];
     }
 }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to