]> ncurses.scripts.mit.edu Git - ncurses.git/blob - ncurses/tinfo/comp_parse.c
ncurses 6.1 - patch 20191015
[ncurses.git] / ncurses / tinfo / comp_parse.c
1 /****************************************************************************
2  * Copyright (c) 1998-2017,2018 Free Software Foundation, Inc.              *
3  *                                                                          *
4  * Permission is hereby granted, free of charge, to any person obtaining a  *
5  * copy of this software and associated documentation files (the            *
6  * "Software"), to deal in the Software without restriction, including      *
7  * without limitation the rights to use, copy, modify, merge, publish,      *
8  * distribute, distribute with modifications, sublicense, and/or sell       *
9  * copies of the Software, and to permit persons to whom the Software is    *
10  * furnished to do so, subject to the following conditions:                 *
11  *                                                                          *
12  * The above copyright notice and this permission notice shall be included  *
13  * in all copies or substantial portions of the Software.                   *
14  *                                                                          *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18  * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21  * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22  *                                                                          *
23  * Except as contained in this notice, the name(s) of the above copyright   *
24  * holders shall not be used in advertising or otherwise to promote the     *
25  * sale, use or other dealings in this Software without prior written       *
26  * authorization.                                                           *
27  ****************************************************************************/
28
29 /****************************************************************************
30  *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
31  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
32  *     and: Thomas E. Dickey                        1996-on                 *
33  ****************************************************************************/
34
35 /*
36  *      comp_parse.c -- parser driver loop and use handling.
37  *
38  *      Use this code by calling _nc_read_entry_source() on as many source
39  *      files as you like (either terminfo or termcap syntax).  If you
40  *      want use-resolution, call _nc_resolve_uses2().  To free the list
41  *      storage, do _nc_free_entries().
42  */
43
44 #include <curses.priv.h>
45
46 #include <ctype.h>
47
48 #include <tic.h>
49
50 MODULE_ID("$Id: comp_parse.c,v 1.106 2018/05/26 14:16:46 tom Exp $")
51
52 static void sanity_check2(TERMTYPE2 *, bool);
53 NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype2) (TERMTYPE2 *, bool) = sanity_check2;
54
55 static void fixup_acsc(TERMTYPE2 *, int);
56
57 static void
58 enqueue(ENTRY * ep)
59 /* add an entry to the in-core list */
60 {
61     ENTRY *newp = _nc_copy_entry(ep);
62
63     if (newp == 0)
64         _nc_err_abort(MSG_NO_MEMORY);
65
66     newp->last = _nc_tail;
67     _nc_tail = newp;
68
69     newp->next = 0;
70     if (newp->last)
71         newp->last->next = newp;
72 }
73
74 #define NAMEBUFFER_SIZE (MAX_NAME_SIZE + 2)
75
76 static char *
77 force_bar(char *dst, char *src)
78 {
79     if (strchr(src, '|') == 0) {
80         size_t len = strlen(src);
81         if (len > MAX_NAME_SIZE)
82             len = MAX_NAME_SIZE;
83         _nc_STRNCPY(dst, src, MAX_NAME_SIZE);
84         _nc_STRCPY(dst + len, "|", NAMEBUFFER_SIZE - len);
85         src = dst;
86     }
87     return src;
88 }
89 #define ForceBar(dst, src) ((strchr(src, '|') == 0) ? force_bar(dst, src) : src)
90
91 #if NCURSES_USE_TERMCAP && NCURSES_XNAMES
92 static char *
93 skip_index(char *name)
94 {
95     char *bar = strchr(name, '|');
96
97     if (bar != 0 && (bar - name) == 2)
98         name = bar + 1;
99
100     return name;
101 }
102 #endif
103
104 static bool
105 check_collisions(char *n1, char *n2, int counter)
106 {
107     char *pstart, *qstart, *pend, *qend;
108     char nc1[NAMEBUFFER_SIZE];
109     char nc2[NAMEBUFFER_SIZE];
110
111     n1 = ForceBar(nc1, n1);
112     n2 = ForceBar(nc2, n2);
113
114 #if NCURSES_USE_TERMCAP && NCURSES_XNAMES
115     if ((_nc_syntax == SYN_TERMCAP) && _nc_user_definable) {
116         n1 = skip_index(n1);
117         n2 = skip_index(n2);
118     }
119 #endif
120
121     for (pstart = n1; (pend = strchr(pstart, '|')); pstart = pend + 1) {
122         for (qstart = n2; (qend = strchr(qstart, '|')); qstart = qend + 1) {
123             if ((pend - pstart == qend - qstart)
124                 && memcmp(pstart, qstart, (size_t) (pend - pstart)) == 0) {
125                 if (counter > 0)
126                     (void) fprintf(stderr, "Name collision '%.*s' between\n",
127                                    (int) (pend - pstart), pstart);
128                 return (TRUE);
129             }
130         }
131     }
132
133     return (FALSE);
134 }
135
136 static char *
137 next_name(char *name)
138 {
139     if (*name != '\0')
140         ++name;
141     return name;
142 }
143
144 static char *
145 name_ending(char *name)
146 {
147     if (*name == '\0') {
148         name = 0;
149     } else {
150         while (*name != '\0' && *name != '|')
151             ++name;
152     }
153     return name;
154 }
155
156 /*
157  * Essentially, find the conflict reported in check_collisions() and remove
158  * it from the second name, unless that happens to be the last alias.
159  */
160 static bool
161 remove_collision(char *n1, char *n2)
162 {
163     char *p2 = n2;
164     char *pstart, *qstart, *pend, *qend;
165     bool removed = FALSE;
166
167 #if NCURSES_USE_TERMCAP && NCURSES_XNAMES
168     if ((_nc_syntax == SYN_TERMCAP) && _nc_user_definable) {
169         n1 = skip_index(n1);
170         p2 = n2 = skip_index(n2);
171     }
172 #endif
173
174     for (pstart = n1; (pend = name_ending(pstart)); pstart = next_name(pend)) {
175         for (qstart = n2; (qend = name_ending(qstart)); qstart = next_name(qend)) {
176             if ((pend - pstart == qend - qstart)
177                 && memcmp(pstart, qstart, (size_t) (pend - pstart)) == 0) {
178                 if (qstart != p2 || *qend == '|') {
179                     if (*qend == '|')
180                         ++qend;
181                     while ((*qstart++ = *qend++) != '\0') ;
182                     fprintf(stderr, "...now\t%s\n", p2);
183                 } else {
184                     fprintf(stderr, "Cannot remove alias '%.*s'\n",
185                             (int) (qend - qstart), qstart);
186                 }
187                 removed = TRUE;
188                 break;
189             }
190         }
191     }
192
193     return removed;
194 }
195
196 /* do any of the aliases in a pair of terminal names match? */
197 NCURSES_EXPORT(bool)
198 _nc_entry_match(char *n1, char *n2)
199 {
200     return check_collisions(n1, n2, 0);
201 }
202
203 /****************************************************************************
204  *
205  * Entry compiler and resolution logic
206  *
207  ****************************************************************************/
208
209 NCURSES_EXPORT(void)
210 _nc_read_entry_source(FILE *fp, char *buf,
211                       int literal, bool silent,
212                       bool(*hook) (ENTRY *))
213 /* slurp all entries in the given file into core */
214 {
215     ENTRY thisentry;
216     bool oldsuppress = _nc_suppress_warnings;
217     int immediate = 0;
218
219     if (silent)
220         _nc_suppress_warnings = TRUE;   /* shut the lexer up, too */
221
222     _nc_reset_input(fp, buf);
223     for (;;) {
224         memset(&thisentry, 0, sizeof(thisentry));
225         if (_nc_parse_entry(&thisentry, literal, silent) == ERR)
226             break;
227         if (!isalnum(UChar(thisentry.tterm.term_names[0])))
228             _nc_err_abort("terminal names must start with letter or digit");
229
230         /*
231          * This can be used for immediate compilation of entries with no "use="
232          * references to disk.  That avoids consuming a lot of memory when the
233          * resolution code could fetch entries off disk.
234          */
235         if (hook != NULLHOOK && (*hook) (&thisentry)) {
236             immediate++;
237         } else {
238             enqueue(&thisentry);
239             /*
240              * The enqueued entry is copied with _nc_copy_termtype(), so we can
241              * free some of the data from thisentry, i.e., the arrays.
242              */
243             FreeIfNeeded(thisentry.tterm.Booleans);
244             FreeIfNeeded(thisentry.tterm.Numbers);
245             FreeIfNeeded(thisentry.tterm.Strings);
246 #if NCURSES_XNAMES
247             FreeIfNeeded(thisentry.tterm.ext_Names);
248 #endif
249         }
250     }
251
252     if (_nc_tail) {
253         /* set up the head pointer */
254         for (_nc_head = _nc_tail; _nc_head->last; _nc_head = _nc_head->last)
255             continue;
256
257         DEBUG(1, ("head = %s", _nc_head->tterm.term_names));
258         DEBUG(1, ("tail = %s", _nc_tail->tterm.term_names));
259     }
260 #ifdef TRACE
261     else if (!immediate)
262         DEBUG(1, ("no entries parsed"));
263 #endif
264
265     _nc_suppress_warnings = oldsuppress;
266 }
267
268 #if NCURSES_XNAMES
269 static unsigned
270 find_capname(TERMTYPE2 *p, const char *name)
271 {
272     unsigned num_names = NUM_EXT_NAMES(p);
273     unsigned n;
274     if (name != 0) {
275         for (n = 0; n < num_names; ++n) {
276             if (!strcmp(p->ext_Names[n], name))
277                 break;
278         }
279     } else {
280         n = num_names + 1;
281     }
282     return n;
283 }
284
285 static int
286 extended_captype(TERMTYPE2 *p, unsigned which)
287 {
288     int result = UNDEF;
289     unsigned limit = 0;
290     limit += p->ext_Booleans;
291     if (limit != 0 && which < limit) {
292         result = BOOLEAN;
293     } else {
294         limit += p->ext_Numbers;
295         if (limit != 0 && which < limit) {
296             result = NUMBER;
297         } else {
298             limit += p->ext_Strings;
299             if (limit != 0 && which < limit) {
300                 result = STRING;
301             } else if (which >= limit) {
302                 result = CANCEL;
303             }
304         }
305     }
306     return result;
307 }
308
309 static const char *
310 name_of_captype(int which)
311 {
312     const char *result = "?";
313     switch (which) {
314     case BOOLEAN:
315         result = "boolean";
316         break;
317     case NUMBER:
318         result = "number";
319         break;
320     case STRING:
321         result = "string";
322         break;
323     }
324     return result;
325 }
326
327 #define valid_TERMTYPE2(p) \
328         ((p) != 0 && \
329          (p)->term_names != 0 && \
330          (p)->ext_Names != 0)
331
332 /*
333  * Disallow changing the type of an extended capability when doing a "use"
334  * if one or the other is a string.
335  */
336 static int
337 invalid_merge(TERMTYPE2 *to, TERMTYPE2 *from)
338 {
339     int rc = FALSE;
340     if (valid_TERMTYPE2(to)
341         && valid_TERMTYPE2(from)) {
342         char *to_name = _nc_first_name(to->term_names);
343         char *from_name = strdup(_nc_first_name(from->term_names));
344         unsigned num_names = NUM_EXT_NAMES(from);
345         unsigned n;
346
347         for (n = 0; n < num_names; ++n) {
348             const char *capname = from->ext_Names[n];
349             int tt = extended_captype(to, find_capname(to, capname));
350             int tf = extended_captype(from, n);
351
352             if (tt <= STRING
353                 && tf <= STRING
354                 && (tt == STRING) != (tf == STRING)) {
355                 if (from_name != 0 && strcmp(to_name, from_name)) {
356                     DEBUG(2,
357                           ("merge of %s to %s changes type of %s from %s to %s",
358                            from_name,
359                            to_name,
360                            from->ext_Names[n],
361                            name_of_captype(tf),
362                            name_of_captype(tt)));
363                 } else {
364                     DEBUG(2, ("merge of %s changes type of %s from %s to %s",
365                               to_name,
366                               from->ext_Names[n],
367                               name_of_captype(tf),
368                               name_of_captype(tt)));
369                 }
370                 _nc_warning("merge changes type of %s from %s to %s",
371                             from->ext_Names[n],
372                             name_of_captype(tf),
373                             name_of_captype(tt));
374                 rc = TRUE;
375             }
376         }
377         free(from_name);
378     }
379     return rc;
380 }
381 #define validate_merge(p, q) \
382         if (invalid_merge(&((p)->tterm), &((q)->tterm))) \
383                 return FALSE
384 #else
385 #define validate_merge(p, q)    /* nothing */
386 #endif
387
388 NCURSES_EXPORT(int)
389 _nc_resolve_uses2(bool fullresolve, bool literal)
390 /* try to resolve all use capabilities */
391 {
392     ENTRY *qp, *rp, *lastread = 0;
393     bool keepgoing;
394     unsigned i;
395     int unresolved, total_unresolved, multiples;
396
397     DEBUG(2, ("RESOLUTION BEGINNING"));
398
399     /*
400      * Check for multiple occurrences of the same name.
401      */
402     multiples = 0;
403     for_entry_list(qp) {
404         int matchcount = 0;
405
406         for_entry_list(rp) {
407             if (qp > rp
408                 && check_collisions(qp->tterm.term_names,
409                                     rp->tterm.term_names,
410                                     matchcount + 1)) {
411                 if (!matchcount++) {
412                     (void) fprintf(stderr, "\t%s\n", rp->tterm.term_names);
413                 }
414                 (void) fprintf(stderr, "and\t%s\n", qp->tterm.term_names);
415                 if (!remove_collision(rp->tterm.term_names,
416                                       qp->tterm.term_names)) {
417                     ++multiples;
418                 }
419             }
420         }
421     }
422     if (multiples > 0)
423         return (FALSE);
424
425     DEBUG(2, ("NO MULTIPLE NAME OCCURRENCES"));
426
427     /*
428      * First resolution stage: compute link pointers corresponding to names.
429      */
430     total_unresolved = 0;
431     _nc_curr_col = -1;
432     for_entry_list(qp) {
433         unresolved = 0;
434         for (i = 0; i < qp->nuses; i++) {
435             bool foundit;
436             char *child = _nc_first_name(qp->tterm.term_names);
437             char *lookfor = qp->uses[i].name;
438             long lookline = qp->uses[i].line;
439
440             if (lookfor == 0)
441                 continue;
442
443             foundit = FALSE;
444
445             _nc_set_type(child);
446
447             /* first, try to resolve from in-core records */
448             for_entry_list(rp) {
449                 if (rp != qp
450                     && _nc_name_match(rp->tterm.term_names, lookfor, "|")) {
451                     DEBUG(2, ("%s: resolving use=%s (in core)",
452                               child, lookfor));
453
454                     qp->uses[i].link = rp;
455                     foundit = TRUE;
456                 }
457             }
458
459             /* if that didn't work, try to merge in a compiled entry */
460             if (!foundit) {
461                 TERMTYPE2 thisterm;
462                 char filename[PATH_MAX];
463
464                 memset(&thisterm, 0, sizeof(thisterm));
465                 if (_nc_read_entry2(lookfor, filename, &thisterm) == 1) {
466                     DEBUG(2, ("%s: resolving use=%s (compiled)",
467                               child, lookfor));
468
469                     TYPE_MALLOC(ENTRY, 1, rp);
470                     rp->tterm = thisterm;
471                     rp->nuses = 0;
472                     rp->next = lastread;
473                     lastread = rp;
474
475                     qp->uses[i].link = rp;
476                     foundit = TRUE;
477                 }
478             }
479
480             /* no good, mark this one unresolvable and complain */
481             if (!foundit) {
482                 unresolved++;
483                 total_unresolved++;
484
485                 _nc_curr_line = (int) lookline;
486                 _nc_warning("resolution of use=%s failed", lookfor);
487                 qp->uses[i].link = 0;
488             }
489         }
490     }
491     if (total_unresolved) {
492         /* free entries read in off disk */
493         _nc_free_entries(lastread);
494         return (FALSE);
495     }
496
497     DEBUG(2, ("NAME RESOLUTION COMPLETED OK"));
498
499     /*
500      * OK, at this point all (char *) references in `name' members
501      * have been successfully converted to (ENTRY *) pointers in
502      * `link' members.  Time to do the actual merges.
503      */
504     if (fullresolve) {
505         do {
506             ENTRY merged;
507
508             keepgoing = FALSE;
509
510             for_entry_list(qp) {
511                 if (qp->nuses > 0) {
512                     DEBUG(2, ("%s: attempting merge",
513                               _nc_first_name(qp->tterm.term_names)));
514                     /*
515                      * If any of the use entries we're looking for is
516                      * incomplete, punt.  We'll catch this entry on a
517                      * subsequent pass.
518                      */
519                     for (i = 0; i < qp->nuses; i++)
520                         if (qp->uses[i].link
521                             && qp->uses[i].link->nuses) {
522                             DEBUG(2, ("%s: use entry %d unresolved",
523                                       _nc_first_name(qp->tterm.term_names), i));
524                             goto incomplete;
525                         }
526
527                     /*
528                      * First, make sure there is no garbage in the
529                      * merge block.  As a side effect, copy into
530                      * the merged entry the name field and string
531                      * table pointer.
532                      */
533                     _nc_copy_termtype2(&(merged.tterm), &(qp->tterm));
534
535                     /*
536                      * Now merge in each use entry in the proper
537                      * (reverse) order.
538                      */
539                     for (; qp->nuses; qp->nuses--) {
540                         validate_merge(&merged,
541                                        qp->uses[qp->nuses - 1].link);
542                         _nc_merge_entry(&merged,
543                                         qp->uses[qp->nuses - 1].link);
544                     }
545
546                     /*
547                      * Now merge in the original entry.
548                      */
549                     validate_merge(&merged, qp);
550                     _nc_merge_entry(&merged, qp);
551
552                     /*
553                      * Replace the original entry with the merged one.
554                      */
555                     FreeIfNeeded(qp->tterm.Booleans);
556                     FreeIfNeeded(qp->tterm.Numbers);
557                     FreeIfNeeded(qp->tterm.Strings);
558 #if NCURSES_XNAMES
559                     FreeIfNeeded(qp->tterm.ext_Names);
560 #endif
561                     qp->tterm = merged.tterm;
562                     _nc_wrap_entry(qp, TRUE);
563
564                     /*
565                      * We know every entry is resolvable because name resolution
566                      * didn't bomb.  So go back for another pass.
567                      */
568                     /* FALLTHRU */
569                   incomplete:
570                     keepgoing = TRUE;
571                 }
572             }
573         } while
574             (keepgoing);
575
576         DEBUG(2, ("MERGES COMPLETED OK"));
577     }
578
579     /*
580      * We'd like to free entries read in off disk at this point, but can't.
581      * The merge_entry() code doesn't copy the strings in the use entries,
582      * it just aliases them.  If this ever changes, do a
583      * free_entries(lastread) here.
584      */
585
586     DEBUG(2, ("RESOLUTION FINISHED"));
587
588     if (fullresolve) {
589         _nc_curr_col = -1;
590         for_entry_list(qp) {
591             _nc_curr_line = (int) qp->startline;
592             _nc_set_type(_nc_first_name(qp->tterm.term_names));
593             /*
594              * tic overrides this function pointer to provide more verbose
595              * checking.
596              */
597             if (_nc_check_termtype2 != sanity_check2) {
598                 SCREEN *save_SP = SP;
599                 SCREEN fake_sp;
600                 TERMINAL fake_tm;
601                 TERMINAL *save_tm = cur_term;
602
603                 /*
604                  * Setup so that tic can use ordinary terminfo interface to
605                  * obtain capability information.
606                  */
607                 memset(&fake_sp, 0, sizeof(fake_sp));
608                 memset(&fake_tm, 0, sizeof(fake_tm));
609                 fake_sp._term = &fake_tm;
610                 TerminalType(&fake_tm) = qp->tterm;
611                 _nc_set_screen(&fake_sp);
612                 set_curterm(&fake_tm);
613
614                 _nc_check_termtype2(&qp->tterm, literal);
615
616                 _nc_set_screen(save_SP);
617                 set_curterm(save_tm);
618             } else {
619                 fixup_acsc(&qp->tterm, literal);
620             }
621         }
622         DEBUG(2, ("SANITY CHECK FINISHED"));
623     }
624
625     return (TRUE);
626 }
627
628 /*
629  * This bit of legerdemain turns all the terminfo variable names into
630  * references to locations in the arrays Booleans, Numbers, and Strings ---
631  * precisely what's needed.
632  */
633
634 #undef CUR
635 #define CUR tp->
636
637 static void
638 fixup_acsc(TERMTYPE2 *tp, int literal)
639 {
640     if (!literal) {
641         if (acs_chars == ABSENT_STRING
642             && PRESENT(enter_alt_charset_mode)
643             && PRESENT(exit_alt_charset_mode))
644             acs_chars = strdup(VT_ACSC);
645     }
646 }
647
648 static void
649 sanity_check2(TERMTYPE2 *tp, bool literal)
650 {
651     if (!PRESENT(exit_attribute_mode)) {
652 #ifdef __UNUSED__               /* this casts too wide a net */
653         bool terminal_entry = !strchr(tp->term_names, '+');
654         if (terminal_entry &&
655             (PRESENT(set_attributes)
656              || PRESENT(enter_standout_mode)
657              || PRESENT(enter_underline_mode)
658              || PRESENT(enter_blink_mode)
659              || PRESENT(enter_bold_mode)
660              || PRESENT(enter_dim_mode)
661              || PRESENT(enter_secure_mode)
662              || PRESENT(enter_protected_mode)
663              || PRESENT(enter_reverse_mode)))
664             _nc_warning("no exit_attribute_mode");
665 #endif /* __UNUSED__ */
666         PAIRED(enter_standout_mode, exit_standout_mode);
667         PAIRED(enter_underline_mode, exit_underline_mode);
668 #if defined(enter_italics_mode) && defined(exit_italics_mode)
669         PAIRED(enter_italics_mode, exit_italics_mode);
670 #endif
671     }
672
673     /* we do this check/fix in postprocess_termcap(), but some packagers
674      * prefer to bypass it...
675      */
676     if (!literal) {
677         fixup_acsc(tp, literal);
678         ANDMISSING(enter_alt_charset_mode, acs_chars);
679         ANDMISSING(exit_alt_charset_mode, acs_chars);
680     }
681
682     /* listed in structure-member order of first argument */
683     PAIRED(enter_alt_charset_mode, exit_alt_charset_mode);
684     ANDMISSING(enter_blink_mode, exit_attribute_mode);
685     ANDMISSING(enter_bold_mode, exit_attribute_mode);
686     PAIRED(exit_ca_mode, enter_ca_mode);
687     PAIRED(enter_delete_mode, exit_delete_mode);
688     ANDMISSING(enter_dim_mode, exit_attribute_mode);
689     PAIRED(enter_insert_mode, exit_insert_mode);
690     ANDMISSING(enter_secure_mode, exit_attribute_mode);
691     ANDMISSING(enter_protected_mode, exit_attribute_mode);
692     ANDMISSING(enter_reverse_mode, exit_attribute_mode);
693     PAIRED(from_status_line, to_status_line);
694     PAIRED(meta_off, meta_on);
695
696     PAIRED(prtr_on, prtr_off);
697     PAIRED(save_cursor, restore_cursor);
698     PAIRED(enter_xon_mode, exit_xon_mode);
699     PAIRED(enter_am_mode, exit_am_mode);
700     ANDMISSING(label_off, label_on);
701 #if defined(display_clock) && defined(remove_clock)
702     PAIRED(display_clock, remove_clock);
703 #endif
704     ANDMISSING(set_color_pair, initialize_pair);
705 }
706
707 #if NO_LEAKS
708 NCURSES_EXPORT(void)
709 _nc_leaks_tic(void)
710 {
711     T((T_CALLED("_nc_free_tic()")));
712     _nc_globals.leak_checking = TRUE;
713     _nc_alloc_entry_leaks();
714     _nc_captoinfo_leaks();
715     _nc_comp_scan_leaks();
716 #if BROKEN_LINKER || USE_REENTRANT
717     _nc_names_leaks();
718     _nc_codes_leaks();
719 #endif
720     _nc_tic_expand(0, FALSE, 0);
721 }
722
723 NCURSES_EXPORT(void)
724 _nc_free_tic(int code)
725 {
726     _nc_leaks_tic();
727     _nc_free_tinfo(code);
728 }
729 #endif