Skip to content

Commit

Permalink
modernize scanmach.d (#15549)
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright authored Sep 21, 2023
1 parent 2bba6f7 commit 400569b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions compiler/src/dmd/scanmach.d
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ private enum LOG = false;
* eSink = where the error messages go
*/
void scanMachObjModule(void delegate(const(char)[] name, int pickAny) pAddSymbol,
const(ubyte)[] base, const(char)* module_name, Loc loc, ErrorSink eSink)
const ubyte[] base, const char* module_name, Loc loc, ErrorSink eSink)
{
static if (LOG)
{
Expand Down Expand Up @@ -96,7 +96,7 @@ void scanMachObjModule(void delegate(const(char)[] name, int pickAny) pAddSymbol
symtab_command* symtab_commands;
// Commands immediately follow mach_header
char* commands = cast(char*)buf + (header.magic == MH_MAGIC_64 ? mach_header_64.sizeof : mach_header.sizeof);
for (uint32_t i = 0; i < ncmds; i++)
foreach (i; 0 .. ncmds)
{
load_command* command = cast(load_command*)commands;
//printf("cmd = 0x%02x, cmdsize = %u\n", command.cmd, command.cmdsize);
Expand All @@ -121,7 +121,7 @@ void scanMachObjModule(void delegate(const(char)[] name, int pickAny) pAddSymbol
return corrupt(__LINE__);

// For each symbol
for (int i = 0; i < symtab_commands.nsyms; i++)
foreach (i; 0 .. symtab_commands.nsyms)
{
nlist_64* s = symtab + i;
const(char)* name = strtab + s.n_strx;
Expand Down Expand Up @@ -172,7 +172,7 @@ void scanMachObjModule(void delegate(const(char)[] name, int pickAny) pAddSymbol
return corrupt(__LINE__);

// For each symbol
for (int i = 0; i < symtab_commands.nsyms; i++)
foreach (i; 0 .. symtab_commands.nsyms)
{
nlist* s = symtab + i;
const(char)* name = strtab + s.n_strx;
Expand Down

0 comments on commit 400569b

Please sign in to comment.