Skip to content

Commit 1614d95

Browse files
Merge pull request #231 from zecke/fix-trace-for-pharo
macos: Fix --trace for the PharoVM
2 parents 4c4686e + ccde31c commit 1614d95

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

platforms/iOS/vm/OSX/sqSqueakOSXApplication.m

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,11 @@ Some of this code was funded via a grant from the European Smalltalk User Group
6565
#ifdef PharoVM
6666
# define VMOPTION(arg) "--"arg
6767
# define VMOPTIONOBJ(arg) @"--"arg
68+
# define VMOPTIONLEN(n) (1+n)
6869
#else
6970
# define VMOPTION(arg) "-"arg
7071
# define VMOPTIONOBJ(arg) @"-"arg
72+
# define VMOPTIONLEN(n) (n)
7173
#endif
7274

7375
usqInt gMaxHeapSize = 512*1024*1024;
@@ -222,19 +224,19 @@ - (int) parseArgument: (NSString *) argData peek: (char *) peek
222224
return 1;
223225
}
224226
#if COGVM
225-
if ([argData compare: VMOPTIONOBJ("trace") options: NSLiteralSearch range: NSMakeRange(0,6)] == NSOrderedSame) {
227+
if ([argData compare: VMOPTIONOBJ("trace") options: NSLiteralSearch range: NSMakeRange(0,VMOPTIONLEN(6))] == NSOrderedSame) {
226228
extern int traceFlags;
227229

228-
if ([argData length] == 6) {
230+
if ([argData length] == VMOPTIONLEN(6)) {
229231
traceFlags = 1;
230232
return 1;
231233
}
232-
if ([argData length] <= 7
233-
|| [argData characterAtIndex: 6] != '='
234-
|| !isdigit([argData characterAtIndex: 7]))
234+
if ([argData length] <= VMOPTIONLEN(7)
235+
|| [argData characterAtIndex: VMOPTIONLEN(6)] != '='
236+
|| !isdigit([argData characterAtIndex: VMOPTIONLEN(7)]))
235237
return 0;
236238

237-
traceFlags = atoi([argData UTF8String] + 7);
239+
traceFlags = atoi([argData UTF8String] + VMOPTIONLEN(7));
238240
return 1;
239241
}
240242
if ([argData isEqualToString: VMOPTIONOBJ("tracestores")]) {

0 commit comments

Comments
 (0)