X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Fcomp_parse.c;h=2bc9485342742708c0452ea90076b9a83837a189;hp=52901f13af53e2db3dd262d88e07ec32cef8d43d;hb=deb0d07e8eb4803b9e9653359eab17a30d04369d;hpb=5f288254c618ae86f3811f2797e4d942061c9101 diff --git a/ncurses/tinfo/comp_parse.c b/ncurses/tinfo/comp_parse.c index 52901f13..2bc94853 100644 --- a/ncurses/tinfo/comp_parse.c +++ b/ncurses/tinfo/comp_parse.c @@ -1,5 +1,6 @@ /**************************************************************************** - * Copyright (c) 1998-2018,2019 Free Software Foundation, Inc. * + * Copyright 2018-2020,2021 Thomas E. Dickey * + * Copyright 1998-2016,2017 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -47,10 +48,10 @@ #include -MODULE_ID("$Id: comp_parse.c,v 1.107 2019/10/19 20:47:43 tom Exp $") +MODULE_ID("$Id: comp_parse.c,v 1.113 2021/05/08 15:03:42 tom Exp $") static void sanity_check2(TERMTYPE2 *, bool); -NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype2) (TERMTYPE2 *, bool) = sanity_check2; +NCURSES_IMPEXP void (NCURSES_API *_nc_check_termtype2) (TERMTYPE2 *, bool) = sanity_check2; static void fixup_acsc(TERMTYPE2 *, int); @@ -391,7 +392,7 @@ _nc_resolve_uses2(bool fullresolve, bool literal) { ENTRY *qp, *rp, *lastread = 0; bool keepgoing; - unsigned i; + unsigned i, j; int unresolved, total_unresolved, multiples; DEBUG(2, ("RESOLUTION BEGINNING")); @@ -453,6 +454,16 @@ _nc_resolve_uses2(bool fullresolve, bool literal) qp->uses[i].link = rp; foundit = TRUE; + + /* verify that there are no earlier uses */ + for (j = 0; j < i; ++j) { + if (qp->uses[j].link != NULL + && !strcmp(qp->uses[j].link->tterm.term_names, + rp->tterm.term_names)) { + _nc_warning("duplicate use=%s", lookfor); + break; + } + } } } @@ -474,6 +485,16 @@ _nc_resolve_uses2(bool fullresolve, bool literal) qp->uses[i].link = rp; foundit = TRUE; + + /* verify that there are no earlier uses */ + for (j = 0; j < i; ++j) { + if (qp->uses[j].link != NULL + && !strcmp(qp->uses[j].link->tterm.term_names, + rp->tterm.term_names)) { + _nc_warning("duplicate use=%s", lookfor); + break; + } + } } } @@ -724,6 +745,6 @@ NCURSES_EXPORT(void) _nc_free_tic(int code) { _nc_leaks_tic(); - _nc_free_tinfo(code); + exit_terminfo(code); } #endif