windows-nt/Source/XPSP1/NT/ds/adsi/nocairo/newop.cxx

67 lines
1.5 KiB
C++
Raw Permalink Normal View History

2020-09-26 03:20:57 -05:00
//---------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 1992 - 1993.
//
// File: MEMORY.CXX
//
//----------------------------------------------------------------------------
#include "dswarn.h"
#include <ADs.hxx>
//+---------------------------------------------------------------------------
//
// Function: ADsAlloc, public
//
// Synopsis: Global allocator for ADs.
//
// Effects: Keeps track of the most recent heap allocation in each
// thread. This information is used to determine when to
// unlink CUnwindable objects.
//
// Arguments: [size] -- Size of the memory to allocate.
//
// Returns: A pointer to the allocated memory.
//
// Modifies: _pLastNew in _exceptioncontext.
//
//----------------------------------------------------------------------------
void*
ADsAlloc( size_t size )
{
void *p;
p = (void *)LocalAlloc( LMEM_FIXED, size );
return ( p );
}
//+---------------------------------------------------------------------------
//
// Function: ADsFree
//
// Synopsis: Matches the ADsAlloc above
//
// Arguments: [p] -- The pointer to delete.
//
// Requires: [p] was called with ADsFree
//
// Derivation: Never override.
//
//----------------------------------------------------------------------------
void
ADsFree ( void * p )
{
if( p == NULL ){
return;
}
if( LocalFree( (HLOCAL)p ) != NULL )
Win4Assert(!"Bad ptr for operator delete");
}