Revision: 41344
http://brlcad.svn.sourceforge.net/brlcad/?rev=41344&view=rev
Author: brlcad
Date: 2010-11-12 22:17:53 +0000 (Fri, 12 Nov 2010)
Log Message:
-----------
get rid of MAXARGS and MAXLINE, managing dynamic memory sized accordingly in
leu of the MAXLINE buffer.
Modified Paths:
--------------
brlcad/trunk/src/lgt/hmenu.c
brlcad/trunk/src/lgt/hmenu.h
Modified: brlcad/trunk/src/lgt/hmenu.c
===================================================================
--- brlcad/trunk/src/lgt/hmenu.c 2010-11-12 22:11:21 UTC (rev 41343)
+++ brlcad/trunk/src/lgt/hmenu.c 2010-11-12 22:17:53 UTC (rev 41344)
@@ -144,8 +144,8 @@
hm_Put_Item(HWindow *win, HMitem *itemp, int flag)
{
int label_len = strlen( itemp->text );
- static char buf[MAXLINE];
- char *p = buf;
+ static char *buf;
+ char *p;
int col = win->menux;
int row = win->menuy+(ENTRY-win->menup->prevtop)+1;
int width = win->width;
@@ -153,6 +153,10 @@
~0 : win->dirty[ENTRY+1];
int bit = 1;
int writemask = 0;
+
+ buf = bu_calloc(1, sizeof(char) * width, "alloc buf");
+ p = buf;
+
if ( bitmap == 0 )
return;
@@ -221,6 +225,7 @@
}
}
}
+ bu_free(buf, "free buf");
if ( flag & P_ON )
(void) ClrStandout();
@@ -235,8 +240,11 @@
int bit = 1;
int col = win->menux;
int bitmap = win->dirty[row - win->menuy];
- static char buf[MAXLINE];
- char *p = buf;
+ static char *buf;
+ char *p;
+
+ buf = bu_calloc(1, sizeof(char) * win->width, "alloc buf");
+ p = buf;
*p++ = (char)mark;
for ( i = 0; i < win->width; i++ )
*p++ = '-';
@@ -250,6 +258,8 @@
else
for ( i = 0; i < p - buf; i++ )
PutMenuChar( buf[i], col, row, bitmap, bit );
+
+ bu_free(buf, "free buf");
return;
}
Modified: brlcad/trunk/src/lgt/hmenu.h
===================================================================
--- brlcad/trunk/src/lgt/hmenu.h 2010-11-12 22:11:21 UTC (rev 41343)
+++ brlcad/trunk/src/lgt/hmenu.h 2010-11-12 22:17:53 UTC (rev 41344)
@@ -83,8 +83,6 @@
extern int hm_ungetchar(int c); /* Can be supplied by application.
*/
extern void hmredraw(void); /* Application signals need for redraw. */
-#define MAXARGS 100
-#define MAXLINE 132
#define MAXVISABLE 10
#endif
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