🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Paul B. McBride Tue, 29 Jan 1991 20:50
Berkeley curses. newwin memory allocation
#267
Author: Paul B. McBride
Date: Tue, 29 Jan 1991 20:50
35 lines
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
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads