Back to index

tetex-bin  3.0
Functions
alloc_ttype.c File Reference
#include <curses.priv.h>
#include <tic.h>
#include <term_entry.h>

Go to the source code of this file.

Functions

 _nc_copy_termtype (TERMTYPE *dst, TERMTYPE *src)

Function Documentation

_nc_copy_termtype ( TERMTYPE *  dst,
TERMTYPE *  src 
)

Definition at line 461 of file alloc_ttype.c.

{
    unsigned i;

    *dst = *src;            /* ...to copy the sizes and string-tables */
    dst->Booleans = typeMalloc(char, NUM_BOOLEANS(dst));
    dst->Numbers = typeMalloc(short, NUM_NUMBERS(dst));
    dst->Strings = typeMalloc(char *, NUM_STRINGS(dst));

    /* FIXME: use memcpy for these and similar loops */
    for_each_boolean(i, dst)
       dst->Booleans[i] = src->Booleans[i];
    for_each_number(i, dst)
       dst->Numbers[i] = src->Numbers[i];
    for_each_string(i, dst)
       dst->Strings[i] = src->Strings[i];

    /* FIXME: we probably should also copy str_table and ext_str_table,
     * but tic and infocmp are not written to exploit that (yet).
     */

#if NCURSES_XNAMES
    if ((i = NUM_EXT_NAMES(src)) != 0) {
       dst->ext_Names = typeMalloc(char *, i);
       memcpy(dst->ext_Names, src->ext_Names, i * sizeof(char *));
    } else {
       dst->ext_Names = 0;
    }
#endif

}

Here is the call graph for this function:

Here is the caller graph for this function: