Changeset f8519e in git for Singular/mmcheck.c


Ignore:
Timestamp:
Jan 26, 1999, 3:41:42 PM (25 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '4bd32dfef92ec9f5ed8dceee82d14318ae147107')
Children:
b6285e707366fbd4f332d38d696bd74910bcbe9e
Parents:
8e012379f6186bcc208b49f8710913df381eb5e3
Message:
* added AllocAligned & FreeAligned


git-svn-id: file:///usr/local/Singular/svn/trunk@2816 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/mmcheck.c

    r8e0123 rf8519e  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: mmcheck.c,v 1.2 1999-01-05 12:18:39 Singular Exp $ */
     4/* $Id: mmcheck.c,v 1.3 1999-01-26 14:41:38 obachman Exp $ */
    55
    66/*
     
    3838 *
    3939 **********************************************************************/
     40
     41void mmMoveDBMCB ( pDBMCB from, pDBMCB to, DBMCB * what )
     42{
     43  what->prev->next = what->next;
     44  if ( what->next != NULL )
     45    what->next->prev = what->prev;
     46  what->prev = to;
     47  what->next = to->next;
     48  if (to->next!=NULL)
     49    to->next->prev=what;
     50  to->next = what;
     51}
     52
     53void mmMoveDBMCBInto ( pDBMCB to, pDBMCB what )
     54{
     55  if (to->next !=NULL)
     56  {
     57    what->next = to->next;
     58    what->next->prev = what;
     59  }
     60  to->next = what;
     61  what->prev = to;
     62}
     63
     64void mmTakeOutDBMCB ( pDBMCB what )
     65{
     66  what->prev->next = what->next;
     67  if ( what->next != NULL )
     68    what->next->prev = what->prev;
     69}
     70
     71void mmDBSetHeapsOfBlocks(memHeap fromheap, memHeap toheap)
     72{
     73  memHeapPage pages = fromheap->pages;
     74  int nblocks = SIZE_OF_HEAP_PAGE / toheap->size;
     75  int i;
     76
     77  assume(fromheap->size == toheap->size);
     78  while (pages != NULL)
     79  {
     80    DBMCB *what = (DBMCB*) (((char*) pages) + SIZE_OF_HEAP_PAGE_HEADER);
     81   
     82    for (i=0; i<nblocks; i++)
     83    {
     84      what->heap = toheap;
     85      what = (DBMCB*) (((char*) what)  + toheap->size);
     86    }
     87    pages = pages->next;
     88  }
     89}
     90
     91void mmDBInitNewHeapPage(memHeap heap)
     92{
     93  DBMCB* what = (DBMCB*) heap->current;
     94  DBMCB* prev = NULL;
     95  size_t size = SizeFromRealSize(heap->size);
     96 
     97  if (mm_minAddr == 0 || mm_minAddr > (void*) what)
     98    mm_minAddr = (void*) what;
     99
     100  while (what != NULL)
     101  {
     102    mmFillDBMCB(what, size, heap, MM_FREEFLAG, __FILE__, __LINE__);   
     103    mmMoveDBMCBInto(&mm_theDBfree, what);
     104    prev = what;
     105    what = *((void**) what);
     106  }
     107 
     108  if (mm_maxAddr == 0 || mm_maxAddr < (void*) prev)
     109    mm_maxAddr = (void*) prev;
     110}
    40111
    41112static int mmPrintDBMCB ( DBMCB * what, char* msg , int given_size)
Note: See TracChangeset for help on using the changeset viewer.