~ubuntu-branches/ubuntu/natty/ncurses/natty

« back to all changes in this revision

Viewing changes to ncurses/tinfo/comp_parse.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-05-17 09:00:42 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070517090042-86fgxrr6j5jzagot
Tags: 5.6-0ubuntu1
* New upstream version.
  - Remove patches applied upstream: ncurses.upstream, signed-chars.
  - Update patches: debian-backspace.
* Build-depend on g++-multilib instead of lib{32,64}c*-dev-*.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/****************************************************************************
2
 
 * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc.              *
 
2
 * Copyright (c) 1998-2005,2006 Free Software Foundation, Inc.              *
3
3
 *                                                                          *
4
4
 * Permission is hereby granted, free of charge, to any person obtaining a  *
5
5
 * copy of this software and associated documentation files (the            *
53
53
#include <tic.h>
54
54
#include <term_entry.h>
55
55
 
56
 
MODULE_ID("$Id: comp_parse.c,v 1.60 2005/06/04 21:42:44 tom Exp $")
 
56
MODULE_ID("$Id: comp_parse.c,v 1.63 2006/07/08 18:55:14 tom Exp $")
57
57
 
58
58
static void sanity_check2(TERMTYPE *, bool);
59
59
NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype2) (TERMTYPE *, bool) = sanity_check2;
107
107
_nc_free_entries(ENTRY * headp)
108
108
/* free the allocated storage consumed by list entries */
109
109
{
 
110
    (void) headp;               /* unused - _nc_head is altered here! */
 
111
 
110
112
    while (_nc_head != 0) {
111
 
        _nc_free_entry(headp, &(headp->tterm));
 
113
        _nc_free_termtype(&(_nc_head->tterm));
112
114
    }
113
115
}
114
116
 
120
122
 
121
123
    for (last = 0, ep = headp; ep != 0; last = ep, ep = ep->next) {
122
124
        if (&(ep->tterm) == tterm) {
123
 
            if (last != 0)
 
125
            if (last != 0) {
124
126
                last->next = ep->next;
125
 
            else
126
 
                headp = ep->next;
127
 
            if (ep == _nc_head)
128
 
                _nc_head = 0;
129
 
            if (ep == _nc_tail)
130
 
                _nc_tail = 0;
 
127
            }
 
128
            if (ep == _nc_head) {
 
129
                _nc_head = ep->next;
 
130
            }
 
131
            if (ep == _nc_tail) {
 
132
                _nc_tail = last;
 
133
            }
131
134
            break;
132
135
        }
133
136
    }
141
144
    ENTRY *ep;
142
145
 
143
146
    if ((ep = _nc_delink_entry(headp, tterm)) != 0) {
144
 
        _nc_free_termtype(&(ep->tterm));
145
147
        free(ep);
146
148
    }
147
149
}
207
209
            _nc_err_abort("terminal names must start with letter or digit");
208
210
 
209
211
        /*
210
 
         * This can be used for immediate compilation of entries with no
211
 
         * use references to disk, so as to avoid chewing up a lot of
212
 
         * core when the resolution code could fetch entries off disk.
 
212
         * This can be used for immediate compilation of entries with no "use="
 
213
         * references to disk.  That avoids consuming a lot of memory when the
 
214
         * resolution code could fetch entries off disk.
213
215
         */
214
216
        if (hook != NULLHOOK && (*hook) (&thisentry)) {
215
217
            immediate++;
216
218
        } else {
217
219
            enqueue(&thisentry);
 
220
            /*
 
221
             * The enqueued entry is copied with _nc_copy_termtype(), so we can
 
222
             * free some of the data from thisentry, i.e., the arrays.
 
223
             */
218
224
            FreeIfNeeded(thisentry.tterm.Booleans);
219
225
            FreeIfNeeded(thisentry.tterm.Numbers);
220
226
            FreeIfNeeded(thisentry.tterm.Strings);
 
227
#if NCURSES_XNAMES
 
228
            FreeIfNeeded(thisentry.tterm.ext_Names);
 
229
#endif
221
230
        }
222
231
    }
223
232
 
374
383
                        }
375
384
 
376
385
                    /*
377
 
                       * First, make sure there's no garbage in the
378
 
                       * merge block.  as a side effect, copy into
379
 
                       * the merged entry the name field and string
380
 
                       * table pointer.
 
386
                     * First, make sure there is no garbage in the
 
387
                     * merge block.  As a side effect, copy into
 
388
                     * the merged entry the name field and string
 
389
                     * table pointer.
381
390
                     */
382
391
                    _nc_copy_termtype(&merged, &(qp->tterm));
383
392
 
400
409
                    FreeIfNeeded(qp->tterm.Booleans);
401
410
                    FreeIfNeeded(qp->tterm.Numbers);
402
411
                    FreeIfNeeded(qp->tterm.Strings);
 
412
#if NCURSES_XNAMES
 
413
                    FreeIfNeeded(qp->tterm.ext_Names);
 
414
#endif
403
415
                    qp->tterm = merged;
404
416
                    _nc_wrap_entry(qp, TRUE);
405
417