Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.2 . Technical Reference - <b>_xvheapresize()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _xvheapresize()
 Resize a segment heap
------------------------------------------------------------------------------
 C Prototype

     #include "vm.api"
     HANDLE _xvheapresize(
                           HANDLE hSegment,
                           USHORT uiSize
                         )

 Arguments

     hSegment is the VM segment handle returned by _xvheapnew().

     uiSize is the new size in bytes.

 Returns

     If successful, _xvheapresize() returns the original VM segment handle;
     otherwise, it returns zero.

 Description

     _xvheapresize() resizes a previously allocated segment heap, shortening
     or lengthening the segment heap to match the specified size.  If you
     shorten the segment heap, bytes at the end of the segment are lost.

     If the resizing is unsuccessful (indicated by a return value of zero),
     the segment heap retains its original size.

     Warning!  Do not use _xvheapresize() to resize a segment heap that
     has any allocated memory block locked.  Unlock the memory block first
     using _xvheapunlock().

 Examples

     .  This example resizes a segment heap:

        // CA-Clipper include files
        #include "extend.api"
        #include "vm.api"

        // Prototype
        Boolean HeapResize(HANDLE hSegment, unsigned uiNewSize);


        Boolean HeapResize(HANDLE hSegment, unsigned uiNewSize)
        {
           Boolean bResult = FALSE;

           // Don't attempt to resize locked segment
           //
           if (_xvlockcount(hSegment) == 0)
              {
              if (_xvheapresize(hSegment, uiNewSize))
                 bResult = TRUE;
              }

           return (bResult);
        }

 Files:  Library is CLIPPER.LIB, header file is Vm.api.


See Also: _xvheapnew()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson