~ubuntu-branches/ubuntu/quantal/aspectc++/quantal

« back to all changes in this revision

Viewing changes to Puma/gen-release/step1/src/List.cc

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-04-10 17:40:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080410174052-xdnsm7oi8hauyyf1
Tags: 1.0pre4~svn.20080409+dfsg-3
Fix another missing include, this time in Ag++/StdSystem.cc

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
  else
94
94
    the_end = (ListElement*)0;
95
95
 
96
 
  while (curr != the_end) {
 
96
  while (curr && curr != the_end) {
97
97
    list->append (*curr->duplicate ());
98
98
    curr = curr->_next;
99
99
  }
102
102
   
103
103
 
104
104
void List::cut (List &out, ListElement *from, ListElement *to) {
105
 
  assert (from);
106
105
  ListElement *curr, *next;
107
106
  ListElement *the_end;
108
107
 
110
109
 
111
110
  if (to)
112
111
    the_end = to->_next;
113
 
  else
 
112
  else if (from)
114
113
    the_end = from->_next;
115
114
 
116
 
  while (curr != the_end) {
 
115
  while (curr && curr != the_end) {
117
116
    next = curr->_next;
118
117
    remove (curr);
119
118
    out.append (*curr);
126
125
  ListElement *curr   = l._first;
127
126
  ListElement *inspos = at;
128
127
 
129
 
  while (curr) {
 
128
  while (curr && inspos) {
130
129
    insert (inspos, *(curr->duplicate ()));
131
130
    inspos = inspos->_next;
132
131
    curr   = curr->_next;
135
134
 
136
135
 
137
136
void List::paste_before (ListElement *at, const List &l) {
138
 
  if (at->_prev)
 
137
  if (at && at->_prev)
139
138
    paste (at->_prev, l);
140
139
  else {
141
140
    ListElement *curr = l._last;
152
151
  ListElement *curr   = l._first;
153
152
  ListElement *inspos = at;
154
153
 
155
 
  while (curr) {
 
154
  while (curr && inspos) {
156
155
    l.remove (curr);
157
156
    insert (inspos, *curr);
158
157
    inspos = inspos->_next;
162
161
 
163
162
 
164
163
void List::move_before (ListElement *at, List &l) {
165
 
  if (at->_prev)
 
164
  if (at && at->_prev)
166
165
    move (at->_prev,l);
167
166
  else {
168
167
    ListElement *curr = l._last;
207
206
  element._prev = at;
208
207
  element._next = at->_next;
209
208
  element._belonging_to = this;
210
 
  if (at->_next)
 
209
  if (at && at->_next)
211
210
    at->_next->_prev = &element;
212
211
  else
213
212
    _last = &element;
214
 
  at->_next = &element;
 
213
  if (at)
 
214
    at->_next = &element;
215
215
}
216
216
 
217
217
 
218
218
void List::remove (ListElement *element) {
219
 
  assert (element);
 
219
  if (! element)
 
220
    return;
 
221
    
220
222
  assert (element->_belonging_to == this);
221
223
  element->_belonging_to = (List*) 0;
222
224