Article View: comp.bugs.4bsd
Article #267Berkeley curses. newwin memory allocation
From: Paul B. McBride
Date: Tue, 29 Jan 1991 20:50
Date: Tue, 29 Jan 1991 20:50
35 lines
1779 bytes
1779 bytes
In looking at the sources to Berkeley curses on uunet, it looks to me
as though newwin.c is allocating 4 times the amount of memory required
to store each window (on a VAX).
The following line in "newwin.c" allocates a buffer for each line of characters
on the screen.
if ((win->_y[i] = malloc(nc * sizeof win->_y[0])) == NULL) {
where "_y" is defined as:
char **_y;
Depending on the difference between the pointer size and the character
size of the machine this results in 2 to 4 times the number of bytes
required. On a VAX "sizeof win->_y[0]" is 4. What should be used
is "sizeof win->_y[0][0]" which is 1. As follows:
if ((win->_y[i] = malloc(nc * sizeof win->_y[0][0])) == NULL) {
This particular problem is quite distressing to me since the reason I
was looking at the sources was to see how the STANDOUT flag was
stored as the eight bit of each character thus preventing 8 bit characters
from being processed properly. So here we have 24 wasted bits at
each screen location and the STANDOUT bit stingily stored in the
eight bit of each character.
What is the solution to handling full 8 bit character sets within curses?
Does System V character attributes do the trick or not?
Please mail responses to uunet!cybvax0!pbm. Thank you.
--
Paul B. McBride (cybvax0!pbm)
Cybermation, Inc. (617) 396-6500
200 Boston Ave., Medford MA 02155
Technical Details
Message-ID:
<1991Jan29.205036.29912@cybvax0.uucp>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!cybvax0!pbmShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!cybvax0!pbm From: pbm@cybvax0.uucp (Paul B. McBride) Newsgroups: comp.bugs.4bsd,comp.unix.wizards Subject: Berkeley curses. newwin memory allocation Message-ID: <1991Jan29.205036.29912@cybvax0.uucp> Date: 29 Jan 91 20:50:36 GMT Distribution: usa Organization: Cybermation, Inc. Lines: 35