Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/Servers/IIS/AspNetCoreModuleV2/CommonLib/EventTracing.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,8 @@
#pragma once

#include <httptrace.h>

#pragma warning( push )
#pragma warning ( disable : ALL_CODE_ANALYSIS_WARNINGS )

#include "aspnetcore_event.h"

#pragma warning( pop )

template< class EVENT, typename ...Params >
void RaiseEvent(IHttpTraceContext * pTraceContext,Params&&... params)
{
Expand Down
128 changes: 64 additions & 64 deletions src/Servers/IIS/AspNetCoreModuleV2/CommonLib/aspnetcore_event.h

Large diffs are not rendered by default.

80 changes: 27 additions & 53 deletions src/Servers/IIS/AspNetCoreModuleV2/IISLib/acache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@

#include "precomp.h"

#pragma warning( push )
#pragma warning ( disable : ALL_CODE_ANALYSIS_WARNINGS )

LONG ALLOC_CACHE_HANDLER::sm_nFillPattern = 0xACA50000;
HANDLE ALLOC_CACHE_HANDLER::sm_hHeap;

#if defined(_MSC_VER)
static_assert(_MSC_VER >= 1600, "This code requires MSVC 10 or later.");
#else
static_assert(false, "This code requires MSVC");
#endif

//
// This class is used to implement the free list. We cast the free'd
// memory block to a FREE_LIST_HEADER*. The signature is used to guard against
Expand All @@ -33,19 +36,19 @@ class FREE_LIST_HEADER
ALLOC_CACHE_HANDLER::ALLOC_CACHE_HANDLER(
) : m_nThreshold(0),
m_cbSize(0),
m_pFreeLists(NULL),
m_pFreeLists(nullptr),
m_nTotal(0)
{
}

ALLOC_CACHE_HANDLER::~ALLOC_CACHE_HANDLER(
)
{
if (m_pFreeLists != NULL)
if (m_pFreeLists != nullptr)
{
CleanupLookaside();
m_pFreeLists->Dispose();
m_pFreeLists = NULL;
m_pFreeLists = nullptr;
}
}

Expand Down Expand Up @@ -140,7 +143,7 @@ VOID
ALLOC_CACHE_HANDLER::StaticTerminate(
)
{
sm_hHeap = NULL;
sm_hHeap = nullptr;
}

VOID
Expand All @@ -163,13 +166,12 @@ ALLOC_CACHE_HANDLER::CleanupLookaside(
// memory must be 16 bytes aligned and currently it is 64.
//

#if defined(_MSC_VER) && _MSC_VER >= 1600 // VC10
auto Predicate = [=] (SLIST_HEADER * pListHeader)
{
LONG NodesToDelete = QueryDepthSList( pListHeader );

PSLIST_ENTRY pl = InterlockedPopEntrySList(pListHeader);
while ( pl != NULL && --NodesToDelete >= 0 )
while ( pl != nullptr && --NodesToDelete >= 0 )
{
InterlockedDecrement( &m_nTotal);

Expand All @@ -178,48 +180,22 @@ ALLOC_CACHE_HANDLER::CleanupLookaside(
pl = InterlockedPopEntrySList(pListHeader);
}
};
#else
class Functor
{
public:
explicit Functor(ALLOC_CACHE_HANDLER * pThis) : _pThis(pThis)
{
}
void operator()(SLIST_HEADER * pListHeader)
{
PSLIST_ENTRY pl;
LONG NodesToDelete = QueryDepthSList( pListHeader );

pl = InterlockedPopEntrySList( pListHeader );
while ( pl != NULL && --NodesToDelete >= 0 )
{
InterlockedDecrement( &_pThis->m_nTotal);

::HeapFree( sm_hHeap, 0, pl );

pl = InterlockedPopEntrySList(pListHeader);
}
}
private:
ALLOC_CACHE_HANDLER * _pThis;
} Predicate(this);
#endif

m_pFreeLists ->ForEach(Predicate);
}

LPVOID
ALLOC_CACHE_HANDLER::Alloc(
)
{
LPVOID pMemory = NULL;
LPVOID pMemory = nullptr;

if ( m_nThreshold > 0 )
{
SLIST_HEADER * pListHeader = m_pFreeLists ->GetLocal();
pMemory = (LPVOID) InterlockedPopEntrySList(pListHeader); // get the real object

if (pMemory != NULL)
if (pMemory != nullptr)
{
FREE_LIST_HEADER* pfl = static_cast<FREE_LIST_HEADER*>(pMemory);
//
Expand All @@ -231,7 +207,7 @@ ALLOC_CACHE_HANDLER::Alloc(
}
}

if ( pMemory == NULL )
if ( pMemory == nullptr )
{
//
// No free entry. Need to alloc a new object.
Expand All @@ -240,7 +216,7 @@ ALLOC_CACHE_HANDLER::Alloc(
0,
m_cbSize );

if ( pMemory != NULL )
if ( pMemory != nullptr )
{
//
// Update counters.
Expand All @@ -249,7 +225,7 @@ ALLOC_CACHE_HANDLER::Alloc(
}
}

if ( pMemory == NULL )
if ( pMemory == nullptr )
{
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
}
Expand All @@ -261,7 +237,7 @@ ALLOC_CACHE_HANDLER::Alloc(

return pMemory;
}

VOID
ALLOC_CACHE_HANDLER::Free(
__in LPVOID pMemory
Expand All @@ -270,7 +246,7 @@ ALLOC_CACHE_HANDLER::Free(
//
// Assume that this is allocated using the Alloc() function.
//
DBG_ASSERT(NULL != pMemory);
DBG_ASSERT(nullptr != pMemory);

//
// Use a signature to check against double deletions.
Expand Down Expand Up @@ -339,7 +315,7 @@ Return Value:
{
DWORD Count = 0;

if (m_pFreeLists != NULL)
if (m_pFreeLists != nullptr)
{
#if defined(_MSC_VER) && _MSC_VER >= 1600 // VC10
auto Predicate = [&Count] (SLIST_HEADER * pListHeader)
Expand Down Expand Up @@ -377,17 +353,17 @@ ALLOC_CACHE_HANDLER::IsPageheapEnabled(
{
BOOL fRet = FALSE;
BOOL fLockedHeap = FALSE;
HMODULE hModule = NULL;
HANDLE hHeap = NULL;
PROCESS_HEAP_ENTRY heapEntry = {0};
HMODULE hModule = nullptr;
HANDLE hHeap = nullptr;
PROCESS_HEAP_ENTRY heapEntry = {};

//
// If verifier.dll is loaded - we are running under app verifier == pageheap is enabled
//
hModule = GetModuleHandle( L"verifier.dll" );
if ( hModule != NULL )
if ( hModule != nullptr)
{
hModule = NULL;
hModule = nullptr;
fRet = TRUE;
goto Finished;
}
Expand All @@ -397,7 +373,7 @@ ALLOC_CACHE_HANDLER::IsPageheapEnabled(
// otherwise HeapWalk turns off lookasides for a useful heap
//
hHeap = ::HeapCreate( 0, 0, 0 );
if ( hHeap == NULL )
if ( hHeap == nullptr )
{
fRet = FALSE;
goto Finished;
Expand Down Expand Up @@ -435,10 +411,8 @@ ALLOC_CACHE_HANDLER::IsPageheapEnabled(
if ( hHeap )
{
DBG_REQUIRE( ::HeapDestroy( hHeap ) );
hHeap = NULL;
hHeap = nullptr;
}

return fRet;
}

#pragma warning( pop )
13 changes: 4 additions & 9 deletions src/Servers/IIS/AspNetCoreModuleV2/IISLib/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
#include <crtdbg.h>
#include <CodeAnalysis/Warnings.h>

#pragma warning( push )
#pragma warning ( disable : ALL_CODE_ANALYSIS_WARNINGS )

//
// BUFFER_T class shouldn't be used directly. Use BUFFER specialization class instead.
// The only BUFFER_T partners are STRU and STRA classes.
Expand Down Expand Up @@ -69,17 +66,17 @@ class BUFFER_T

--*/
{
_ASSERTE( NULL != pbInit );
_ASSERTE(nullptr != pbInit );
_ASSERTE( cbInit > 0 );
}

~BUFFER_T()
{
if( IsHeapAllocated() )
{
_ASSERTE( NULL != m_pBuffer );
_ASSERTE( nullptr != m_pBuffer );
HeapFree( GetProcessHeap(), 0, m_pBuffer );
m_pBuffer = NULL;
m_pBuffer = nullptr;
m_cbBuffer = 0;
m_fHeapAllocated = false;
}
Expand Down Expand Up @@ -155,7 +152,7 @@ class BUFFER_T
pNewMem = HeapAlloc( GetProcessHeap(), dwHeapAllocFlags, cbNewSize );
}

if( pNewMem == NULL )
if( pNewMem == nullptr )
{
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
return false;
Expand Down Expand Up @@ -272,5 +269,3 @@ C_ASSERT( sizeof(VOID*) <= sizeof(ULONGLONG) );

#define INLINE_BUFFER_INIT( _name ) \
_name( (BYTE*)__aqw##_name, sizeof( __aqw##_name ) )

#pragma warning( pop )
10 changes: 5 additions & 5 deletions src/Servers/IIS/AspNetCoreModuleV2/IISLib/percpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ PER_CPU<T>::Create(
DWORD CacheLineSize = 0;
DWORD ObjectCacheLineSize = 0;
DWORD NumberOfProcessors = 0;
PER_CPU<T> * pInstance = NULL;
PER_CPU<T> * pInstance = nullptr;

hr = GetProcessorInformation(&CacheLineSize,
&NumberOfProcessors);
Expand Down Expand Up @@ -124,7 +124,7 @@ PER_CPU<T>::Create(
SIZE_T Size = CacheLineSize + NumberOfProcessors * ObjectCacheLineSize;

pInstance = (PER_CPU<T>*) _aligned_malloc(Size, CacheLineSize);
if (pInstance == NULL)
if (pInstance == nullptr)
{
hr = E_OUTOFMEMORY;
goto Finished;
Expand All @@ -150,17 +150,17 @@ PER_CPU<T>::Create(
}

*ppInstance = pInstance;
pInstance = NULL;
pInstance = nullptr;

Finished:

if (pInstance != NULL)
if (pInstance != nullptr)
{
//
// Free the instance without disposing it.
//
pInstance->Dispose();
pInstance = NULL;
pInstance = nullptr;
}

return hr;
Expand Down
5 changes: 0 additions & 5 deletions src/Servers/IIS/AspNetCoreModuleV2/IISLib/reftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <windows.h>
#include "reftrace.h"


PTRACE_LOG
CreateRefTraceLog(
IN LONG LogSize,
Expand Down Expand Up @@ -40,7 +39,6 @@ Return Value:

} // CreateRefTraceLog


VOID
DestroyRefTraceLog(
IN PTRACE_LOG Log
Expand All @@ -66,7 +64,6 @@ Return Value:

} // DestroyRefTraceLog


//
// N.B. For RtlCaptureBacktrace() to work properly, the calling function
// *must* be __cdecl, and must have a "normal" stack frame. So, we decorate
Expand Down Expand Up @@ -119,8 +116,6 @@ Return Value:
} // WriteRefTraceLog




LONG
__cdecl
WriteRefTraceLogEx(
Expand Down
Loading
Loading