Revision: 56219
          http://sourceforge.net/p/brlcad/code/56219
Author:   starseeker
Date:     2013-07-25 17:03:07 +0000 (Thu, 25 Jul 2013)
Log Message:
-----------
Don't bother with avs and region flags at all unless we have to.

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

Modified: brlcad/trunk/src/libged/comb.c
===================================================================
--- brlcad/trunk/src/libged/comb.c      2013-07-25 17:02:27 UTC (rev 56218)
+++ brlcad/trunk/src/libged/comb.c      2013-07-25 17:03:07 UTC (rev 56219)
@@ -140,38 +140,37 @@
     }
 
     /* Make sure the region flag is set appropriately */
-    if ((dp = db_lookup(gedp->ged_wdbp->dbip, comb_name, LOOKUP_NOISY)) != 
RT_DIR_NULL) {
-       bu_avs_init_empty(&avs);
-       if (db5_get_attributes(gedp->ged_wdbp->dbip, &avs, dp)) {
-           bu_vls_printf(gedp->ged_result_str, "Cannot get attributes for 
object %s\n", dp->d_namep);
-           return GED_ERROR;
-       }
-       db5_standardize_avs(&avs);
-       if (set_region) {
-           dp->d_flags |= RT_DIR_REGION;
-           (void)bu_avs_add(&avs, "region", "R");
-           if (db5_update_attributes(dp, &avs, gedp->ged_wdbp->dbip)) {
-               bu_vls_printf(gedp->ged_result_str,
-                       "Error: failed to update attributes\n");
-               bu_avs_free(&avs);
+    if (set_comb || set_region) {
+       if ((dp = db_lookup(gedp->ged_wdbp->dbip, comb_name, LOOKUP_NOISY)) != 
RT_DIR_NULL) {
+           bu_avs_init_empty(&avs);
+           if (db5_get_attributes(gedp->ged_wdbp->dbip, &avs, dp)) {
+               bu_vls_printf(gedp->ged_result_str, "Cannot get attributes for 
object %s\n", dp->d_namep);
                return GED_ERROR;
            }
-       }
-       if (set_comb) {
-           dp->d_flags = dp->d_flags & ~(RT_DIR_REGION);
-           (void)bu_avs_remove(&avs, "region");
-           if (db5_replace_attributes(dp, &avs, gedp->ged_wdbp->dbip)) {
-               bu_vls_printf(gedp->ged_result_str,
-                       "Error: failed to update attributes\n");
-               bu_avs_free(&avs);
-               return GED_ERROR;
+           db5_standardize_avs(&avs);
+           if (set_region) {
+               dp->d_flags |= RT_DIR_REGION;
+               (void)bu_avs_add(&avs, "region", "R");
+               if (db5_update_attributes(dp, &avs, gedp->ged_wdbp->dbip)) {
+                   bu_vls_printf(gedp->ged_result_str,
+                           "Error: failed to update attributes\n");
+                   bu_avs_free(&avs);
+                   return GED_ERROR;
+               }
            }
+           if (set_comb) {
+               dp->d_flags = dp->d_flags & ~(RT_DIR_REGION);
+               (void)bu_avs_remove(&avs, "region");
+               if (db5_replace_attributes(dp, &avs, gedp->ged_wdbp->dbip)) {
+                   bu_vls_printf(gedp->ged_result_str,
+                           "Error: failed to update attributes\n");
+                   bu_avs_free(&avs);
+                   return GED_ERROR;
+               }
+           }
        }
+    }
 
-       if (!set_comb && !set_region)
-           bu_avs_free(&avs);
-    }    
-
     return GED_OK;
 }
 

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


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to