home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / clib / progs / clibs / HeapGraph / !HeapDisp / c / RemoveBloc < prev    next >
Encoding:
Text File  |  1994-09-02  |  936 b   |  49 lines

  1. #include "DeskLib:WimpSWIs.h"
  2.  
  3. #include "Shell.Extra.h"
  4. #include "Shell.TextRect.h"
  5.  
  6. #include "RemoveBloc.h"
  7.  
  8.  
  9.  
  10.  
  11. void    RemoveBlock( app_block *app, int pos)
  12. {
  13. int    i, j;
  14. BOOL    found = FALSE;
  15.  
  16. for ( i=0; i<app->num_blocks; i++)    {
  17.     if ( app->blocks[i].pos == pos)    {
  18.         app->stats.total -= app->blocks[i].size;
  19.         for ( j=i+1; j<app->num_blocks; j++)    {
  20.             app->blocks[ j-1] = app->blocks[ j];
  21.             }
  22.         app->num_blocks--;
  23.         found = TRUE;
  24.         break;
  25.         }
  26.     }
  27.  
  28. if ( !found)    {
  29.     Shell_TextRectPrintf( app->textrect,
  30.         "Attempt to free non-existent block at location %x\n",
  31.         pos
  32.         );
  33.     }
  34.  
  35. else    Shell_ForceRectUpdateSlow( app->heaprect);
  36.  
  37.     /* Should only update the new bit of the heap...    */
  38.     /*
  39.     {
  40.     wimp_rect    rect;
  41.     rect.min.x = app->heapdisplay->rect.min.x;
  42.     rect.max.x = app->heapdisplay->rect.max.x;
  43.     rect.min.y = app->heapdisplay->rect.min.y + pos/app->words_per_os;
  44.     rect.max.y = app->heapdisplay->rect.min.y + (pos+size)/app->words_per_os;
  45.     }
  46.     */
  47.  
  48. }
  49.