Revision: 41337
http://brlcad.svn.sourceforge.net/brlcad/?rev=41337&view=rev
Author: brlcad
Date: 2010-11-12 21:39:38 +0000 (Fri, 12 Nov 2010)
Log Message:
-----------
use ged_count_tops() to get the size that we need to allocate so MAXARGS can be
eliminated and code can be simplified.
Modified Paths:
--------------
brlcad/trunk/src/libdm/dm-rtgl.c
brlcad/trunk/src/mged/cmd.c
Modified: brlcad/trunk/src/libdm/dm-rtgl.c
===================================================================
--- brlcad/trunk/src/libdm/dm-rtgl.c 2010-11-12 21:38:50 UTC (rev 41336)
+++ brlcad/trunk/src/libdm/dm-rtgl.c 2010-11-12 21:39:38 UTC (rev 41337)
@@ -1671,14 +1671,8 @@
}
/* 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");
- }
+ visibleCount = ged_count_tops(gedp);
+ visibleTrees = (char **)bu_calloc(visibleCount, sizeof(char *), "alloc
visibleTrees");
/* get number and names of visible tree tops */
numVisible = ged_build_tops(gedp, visibleTrees,
&visibleTrees[visibleCount]);
Modified: brlcad/trunk/src/mged/cmd.c
===================================================================
--- brlcad/trunk/src/mged/cmd.c 2010-11-12 21:38:50 UTC (rev 41336)
+++ brlcad/trunk/src/mged/cmd.c 2010-11-12 21:39:38 UTC (rev 41337)
@@ -262,10 +262,14 @@
int i;
int ret;
struct cmdtab *ctp = (struct cmdtab *)clientData;
+ size_t args;
if (gedp == GED_NULL)
return TCL_OK;
+ args = argc + 2 + ged_count_tops(gedp);
+ gedp->ged_gdp->gd_rt_cmd = (char **)bu_calloc(args, sizeof(char *), "alloc
gd_rt_cmd");
+
vp = &gedp->ged_gdp->gd_rt_cmd[0];
/* Grab command name and any options */
@@ -302,12 +306,14 @@
gedp->ged_gdp->gd_rt_cmd_len = vp - gedp->ged_gdp->gd_rt_cmd;
gedp->ged_gdp->gd_rt_cmd_len += ged_build_tops(gedp,
vp,
-
&gedp->ged_gdp->gd_rt_cmd[MAXARGS]);
+
&gedp->ged_gdp->gd_rt_cmd[args]);
}
ret = (*ctp->ged_func)(gedp, gedp->ged_gdp->gd_rt_cmd_len, (const char
**)gedp->ged_gdp->gd_rt_cmd);
Tcl_AppendResult(interpreter, bu_vls_addr(&gedp->ged_result_str), NULL);
+ bu_free(gedp->ged_gdp->gd_rt_cmd, "free gd_rt_cmd");
+
if (ret & GED_HELP)
return TCL_OK;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits