Ignore:
Timestamp:
1999-10-18T12:43:31+13:00 (25 years ago)
Author:
cs025
Message:

Changes to eradicate Xmalloc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/mgpp/text/query.ranked.cpp

    r660 r711  
    5151/*
    5252   $Log$
     53   Revision 1.3  1999/10/17 23:43:29  cs025
     54   Changes to eradicate Xmalloc
     55
    5356   Revision 1.2  1999/10/12 04:13:52  cs025
    5457   Calls to GetEnv eradicated; interface to parsing of query text
     
    128131    int MaxSize;
    129132    HeapComp HC;
    130     HeapEntry HE[1];
     133    HeapEntry *HE;
     134
     135    Heap(int size)
     136    {
     137      HE = new HeapEntry[size];
     138    }
     139
     140    ~Heap()
     141    {
     142      if (HE != NULL)
     143    delete HE;
     144    }
    131145  }
    132146Heap;
     
    137151{
    138152  Heap *H;
    139   H = (Heap *) Xmalloc (sizeof (Heap) + (size - 1) * sizeof (HeapEntry));
     153  H = new Heap(size);
    140154  if (!H)
    141155    return NULL;
     
    644658     document weights which we retrieve from the ".idx.wgt" file and put
    645659     the resulting data into a heap */
    646 
    647 
    648660  he = H->HE;
    649661  H->NumItems = MaxDocs;
     
    805817    }
    806818
    807 
    808819  if (rqi->Exact && qd->id->ifh.InvfLevel != 3)
    809820    {
     
    957968    }
    958969    }
    959 
    960 
    961970
    962971  H->HC = Heap_Greater;
     
    10621071    LT_free (qd, LT);
    10631072
    1064   if (H) Xfree (H); /* [RJM 07/98: Memory Leak] */
     1073  if (H) delete H; /* [RJM 07/98: Memory Leak] */
    10651074
    10661075  return (Docs);
Note: See TracChangeset for help on using the changeset viewer.