home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 2 / RISC_DISC_2.iso / pd_share / program / code / stubshack / HeapGraph / !HeapDisp / c / RemoveBloc < prev    next >
Encoding:
Text File  |  1994-11-29  |  1.0 KB  |  52 lines

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