Revision: 41317
http://brlcad.svn.sourceforge.net/brlcad/?rev=41317&view=rev
Author: brlcad
Date: 2010-11-10 20:19:21 +0000 (Wed, 10 Nov 2010)
Log Message:
-----------
remove couple more instances of fixed-size RT_MAXARGS arrays. make
visibleTrees array size dynamic, exactly big enough to fix the max number it
might possibly store.
Modified Paths:
--------------
brlcad/trunk/src/libdm/dm-rtgl.c
Modified: brlcad/trunk/src/libdm/dm-rtgl.c
===================================================================
--- brlcad/trunk/src/libdm/dm-rtgl.c 2010-11-10 19:57:23 UTC (rev 41316)
+++ brlcad/trunk/src/libdm/dm-rtgl.c 2010-11-10 20:19:21 UTC (rev 41317)
@@ -1623,11 +1623,15 @@
HIDDEN int
rtgl_drawVList(struct dm *dmp, struct bn_vlist *UNUSED(vp))
{
- size_t i, j, new, numVisible, numNew, maxPixels, viewSize;
+ size_t i, j, new, numNew, maxPixels, viewSize;
vect_t span;
- char *currTree, *visibleTrees[RT_MAXARGS];
+ char *currTree;
struct db_i *dbip;
struct jobList jobs;
+
+ size_t numVisible = 0;
+ size_t visibleCount = 0;
+ char **visibleTrees = NULL;
int foundalloldtrees = 1;
int foundthistree = 0;
@@ -1666,8 +1670,18 @@
rtgljob.colorTable = bu_create_hash_tbl(START_TABLE_SIZE);
}
+ /* allocate our visible trees */
+ {
+ struct ged_display_list *gdlp;
+ visibleCount = 0;
+ for (BU_LIST_FOR(gdlp, ged_display_list,
&gedp->ged_gdp->gd_headDisplay)) {
+ visibleCount++;
+ }
+ visibleTrees = (char **)bu_calloc(visibleCount, sizeof(char *), "alloc
visibleTrees");
+ }
+
/* get number and names of visible tree tops */
- numVisible = ged_build_tops(gedp, visibleTrees, &visibleTrees[RT_MAXARGS]);
+ numVisible = ged_build_tops(gedp, visibleTrees,
&visibleTrees[visibleCount]);
for (i = 0; i < rtgljob.numTrees; i++) {
currTree = rtgljob.oldTrees[i];
@@ -1811,7 +1825,7 @@
rtgljob.numTrees = 0;
numShot = rtgljob.numJobs = 0;
rtgljob.currJob = NULL;
- numVisible = ged_build_tops(gedp, visibleTrees,
&visibleTrees[RT_MAXARGS]);
+ numVisible = ged_build_tops(gedp, visibleTrees,
&visibleTrees[visibleCount]);
for (i = 0; i < numVisible; i++) {
currTree = visibleTrees[i];
new = 1;
@@ -1893,6 +1907,12 @@
} /* numNew > 0 */
+ /* done with visibleTrees */
+ if (visibleTrees != NULL) {
+ bu_free(visibleTrees, "free visibleTrees");
+ visibleTrees = NULL;
+ }
+
/* get view vector */
bn_vec_aed(view, gedp->ged_gvp->gv_aet[0]*DEG2RAD,
gedp->ged_gvp->gv_aet[1]*DEG2RAD, 1);
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a
Billion" shares his insights and actions to help propel your
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits