~vibhavp/ubuntu/raring/ebook-tools/add-autopkgtest

« back to all changes in this revision

Viewing changes to src/libepub/linklist.c

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-09-10 14:06:04 UTC
  • mto: (5.1.3 maverick)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20100910140604-ge4cw5cetcsetrxv
Tags: upstream-0.2.0
ImportĀ upstreamĀ versionĀ 0.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
  if ((List->Flags & LISTADDMASK) & LISTADDSPLAY)
100
100
    { /* List is a splay tree; do weirdness... */
101
101
      if (SplayList(List, Data) != NULL)
102
 
        Compare = 0;
 
102
                  Compare = 0;
103
103
    }
104
104
  if ((List->Flags & LISTFLAGMASK) & LISTBTREE)
105
105
    { /* List is some other binary tree, do a binary tree search... */
106
106
      if (BTFind(List, Data) != NULL)
107
 
        Compare = 0;
 
107
                  Compare = 0;
108
108
    }
109
109
  else
110
110
    { /* List is a normal list, not a tree, step through it... */
111
111
      
112
112
      List->Current = List->Head;
113
113
      if (List->Current == NULL)
114
 
        return NULL;
 
114
                  return NULL;
115
115
      
116
 
      while ((Compare = (List->compare)(List->Current->Data, Data)) != 0)
117
 
        List->Current = List->Current->Next;
 
116
      while ((Compare = (List->compare)(List->Current->Data, Data)) != 0) {
 
117
                  List->Current = List->Current->Next;
 
118
                  if (List->Current == NULL)
 
119
                          return NULL; // end of list
 
120
          }
118
121
    }
119
122
 
120
123
  if (Compare != 0)
272
275
  
273
276
int SplayRemoveList(listPtr List)
274
277
{
275
 
  listnodePtr DelNode;
 
278
  listnodePtr _DelNode;
276
279
 
277
280
  if (List == NULL) return LLIST_NULL;
278
281
  if (List->Head == NULL) return LLIST_NOERROR;
280
283
  /* Assumes List->Head (root of splay tree) is already selected to
281
284
     be deleted node */
282
285
 
283
 
  DelNode = List->Head;
 
286
  _DelNode = List->Head;
284
287
  if (List->Head->Next == NULL)
285
288
    List->Head = List->Head->Prev;
286
289
  else 
288
291
      if (List->Head->Prev != NULL)
289
292
        {
290
293
          SplayList(List, List->Head->Prev->Data);   /* Must succeed */
291
 
          List->Head->Next = DelNode->Next;
 
294
          List->Head->Next = _DelNode->Next;
292
295
        }
293
296
      else
294
297
        List->Head = List->Head->Next;
295
298
    }
296
299
  
297
 
  List->memfree(DelNode);
 
300
  List->memfree(_DelNode);
298
301
  List->Current = List->Head;
299
302
  
300
303
  List->Size--;