Skip to content

Commit caf9177

Browse files
committed
Replace defines with static consts.
1 parent 221a470 commit caf9177

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

MemoryModule.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ FinalizeSections(PMEMORYMODULE module)
257257
#ifdef _WIN64
258258
uintptr_t imageOffset = (module->headers->OptionalHeader.ImageBase & 0xffffffff00000000);
259259
#else
260-
#define imageOffset 0
260+
static const uintptr_t imageOffset = 0;
261261
#endif
262262
SECTIONFINALIZEDATA sectionData;
263263
sectionData.address = (LPVOID)((uintptr_t)section->Misc.PhysicalAddress | imageOffset);
@@ -298,9 +298,6 @@ FinalizeSections(PMEMORYMODULE module)
298298
if (!FinalizeSection(module, &sectionData)) {
299299
return FALSE;
300300
}
301-
#ifndef _WIN64
302-
#undef imageOffset
303-
#endif
304301
return TRUE;
305302
}
306303

@@ -838,7 +835,7 @@ static PIMAGE_RESOURCE_DIRECTORY_ENTRY _MemorySearchResourceEntry(
838835
#else
839836
// Resource names are always stored using 16bit characters, need to
840837
// convert string we search for.
841-
#define MAX_LOCAL_KEY_LENGTH 2048
838+
static const size_t MAX_LOCAL_KEY_LENGTH = 2048;
842839
// In most cases resource names are short, so optimize for that by
843840
// using a pre-allocated array.
844841
wchar_t _searchKeySpace[MAX_LOCAL_KEY_LENGTH+1];
@@ -887,7 +884,6 @@ static PIMAGE_RESOURCE_DIRECTORY_ENTRY _MemorySearchResourceEntry(
887884
if (searchKeyLen > MAX_LOCAL_KEY_LENGTH) {
888885
free(_searchKey);
889886
}
890-
#undef MAX_LOCAL_KEY_LENGTH
891887
#endif
892888
}
893889

0 commit comments

Comments
 (0)