Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitac89ef0

Browse files
authored
Merge pull requestskx#22 from keroro520/master
Fetch DEBUG dynamicly
2 parents6488344 +6b9b5c9 commitac89ef0

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

‎src/main.c‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void error(char *msg)
3636

3737

3838

39-
intrun_file(constchar*filename,intdump_registers,intinstructions)
39+
intrun_file(constchar*filename,intinstructions)
4040
{
4141
structstatsb;
4242

@@ -56,14 +56,13 @@ int run_file(const char *filename, int dump_registers, int instructions)
5656
}
5757

5858
unsignedchar*code=malloc(size);
59-
memset(code,'\0',size);
60-
6159
if (!code)
6260
{
6361
printf("Failed to allocate RAM for program-file %s\n",filename);
6462
fclose(fp);
6563
return1;
6664
}
65+
memset(code,'\0',size);
6766

6867
/**
6968
* Abort on a short-read, or error.
@@ -99,7 +98,7 @@ int run_file(const char *filename, int dump_registers, int instructions)
9998
/**
10099
* Dump?
101100
*/
102-
if (dump_registers)
101+
if (getenv("DEBUG")!=NULL)
103102
svm_dump_registers(cpu);
104103

105104

@@ -122,7 +121,6 @@ int run_file(const char *filename, int dump_registers, int instructions)
122121
*/
123122
intmain(intargc,char**argv)
124123
{
125-
intdump_registers=0;
126124
intmax_instructions=0;
127125

128126
if (argc<2)
@@ -134,9 +132,6 @@ int main(int argc, char **argv)
134132
if (argc>2 )
135133
max_instructions=atoi(argv[2]);
136134

137-
if (getenv("DEBUG")!=NULL)
138-
dump_registers=1;
139-
140-
return (run_file(argv[1],dump_registers,max_instructions));
135+
return (run_file(argv[1],max_instructions));
141136

142137
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp