[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Minor corrections

From: Thomas Dickey
Subject: Re: Minor corrections
Date: Tue, 21 Aug 2001 14:35:06 -0400
User-agent: Mutt/1.2.5i

On Tue, Aug 21, 2001 at 07:14:29AM +0200, philippe blain wrote:
> --------------------------------------------------------------------------------
> File : ncurses/ncurses.priv.h
> Suggestion :   Replace the structure WINDOWLIST
>     typedef struct _win_list {
>         struct _win_list *next;
>         WINDOW *win;
> with a doubly linked list directly in the WINDOW structure accessed
> by SP->_nc_sp_window. No need to allocate memory for a WINDOWLIST
> each time a window is created by that way.

better solution - after thinking about my first response: make WINDOW
a part of the WINDOWLIST struct, and return pointers to it, e.g.,

      typedef struct _win_list {
          struct _win_list *next;
          WINDOW win;           /* address of this is used in applications */

That reduces the number of mallocs as you suggest, and is transparent to
the applications.  (For compatibility, the links can't be part of the
WINDOW struct unless they were added to the end of the struct, since
that would otherwise change the offsets that existing applications use).

Thomas E. Dickey <address@hidden>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]