1 /****************************************************************************
2 * Copyright 2020,2022 Thomas E. Dickey *
3 * Copyright 1999-2011,2017 Free Software Foundation, Inc. *
5 * Permission is hereby granted, free of charge, to any person obtaining a *
6 * copy of this software and associated documentation files (the *
7 * "Software"), to deal in the Software without restriction, including *
8 * without limitation the rights to use, copy, modify, merge, publish, *
9 * distribute, distribute with modifications, sublicense, and/or sell *
10 * copies of the Software, and to permit persons to whom the Software is *
11 * furnished to do so, subject to the following conditions: *
13 * The above copyright notice and this permission notice shall be included *
14 * in all copies or substantial portions of the Software. *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
19 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
22 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
24 * Except as contained in this notice, the name(s) of the above copyright *
25 * holders shall not be used in advertising or otherwise to promote the *
26 * sale, use or other dealings in this Software without prior written *
28 ****************************************************************************/
30 /****************************************************************************
31 * Author: Thomas E. Dickey 1999-on *
32 ****************************************************************************/
35 * free_ttype.c -- allocation functions for TERMTYPE
38 * use_extended_names()
42 #include <curses.priv.h>
46 MODULE_ID("$Id: free_ttype.c,v 1.21 2022/05/28 18:02:33 tom Exp $")
49 really_free_termtype(TERMTYPE2 *ptr, bool freeStrings)
51 T(("really_free_termtype(%s) %d", ptr->term_names, freeStrings));
54 FreeIfNeeded(ptr->str_table);
56 FreeIfNeeded(ptr->Booleans);
57 FreeIfNeeded(ptr->Numbers);
58 FreeIfNeeded(ptr->Strings);
61 FreeIfNeeded(ptr->ext_str_table);
63 FreeIfNeeded(ptr->ext_Names);
65 memset(ptr, 0, sizeof(TERMTYPE));
66 _nc_free_entry(_nc_head, ptr);
70 * This entrypoint was used by tack 1.07; deprecated with ncurses 6.2
73 _nc_free_termtype(TERMTYPE *ptr)
75 really_free_termtype((TERMTYPE2 *) ptr, !NCURSES_EXT_NUMBERS);
79 * These similar entrypoints are not used outside of ncurses.
82 _nc_free_termtype1(TERMTYPE *ptr)
84 really_free_termtype((TERMTYPE2 *) ptr, TRUE);
87 #if NCURSES_EXT_NUMBERS
89 _nc_free_termtype2(TERMTYPE2 *ptr)
91 really_free_termtype(ptr, TRUE);
96 NCURSES_EXPORT_VAR(bool) _nc_user_definable = TRUE;
99 use_extended_names(bool flag)
101 int oldflag = _nc_user_definable;
104 T((T_CALLED("use_extended_names(%d)"), flag));
105 _nc_user_definable = flag;