|
|
Microsoft OS/2 SDK 03-01-1988
/* Created by Microsoft Corp. 1987 */
#define INCL_DOSMEMMGR
#include <os2def.h>
#include <bsedos.h>
#include "ssedefs.h"
/*** allocseg - allocates segments.
*
* allocseg uses DosAllocSeg to allocate segments from OS/2.
*
* This routine will return an error code if it is unable to
* allocate the segment.
*
* EXIT rc - return code of DosAllocSeg
*
*
* EFFECTS : allocates memory from OS/2
* modifies SegTable (by adding a new segment)
* modifies TotalSegs (by incrementing it by one)
*/
SHORT allocseg()
{
SHORT rc; /* return code of OS/2 call */
rc = DosAllocSeg(SEGSIZE,
&(SegTable[TotalSegs].segment),
NOTSHARED);
if (rc == 0) {
SegTable[TotalSegs].free = SEGSIZE;
++TotalSegs;
}
return(rc);
} /* end allocseg */
/*** freesegs - free segments
*
* freesegs uses DosFreeSeg to free all the segments
* allocated by allocseg.
*
* EFFECTS: frees all alocated memory (segments) to OS/2
* sets TotalSegs to zero
* makes SegTable invalid
*/
void freesegs()
{
register USHORT i;
for (i = 0; i < TotalSegs; i++) {
DosFreeSeg(SegTable[i].segment);
}
TotalSegs = 0;
} /* end freesegs */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.