From ccde31cfdfd45ea7246c236809b68f8ccb1088d8 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sun, 25 Mar 2018 06:31:23 +0100 Subject: [PATCH] macos: Fix --trace for the PharoVM Introduce VMOPTIONLEN that can offset the extra '-' in the calculations. --- platforms/iOS/vm/OSX/sqSqueakOSXApplication.m | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/platforms/iOS/vm/OSX/sqSqueakOSXApplication.m b/platforms/iOS/vm/OSX/sqSqueakOSXApplication.m index 55f346bb2b..9a37376314 100644 --- a/platforms/iOS/vm/OSX/sqSqueakOSXApplication.m +++ b/platforms/iOS/vm/OSX/sqSqueakOSXApplication.m @@ -65,9 +65,11 @@ Some of this code was funded via a grant from the European Smalltalk User Group #ifdef PharoVM # define VMOPTION(arg) "--"arg # define VMOPTIONOBJ(arg) @"--"arg +# define VMOPTIONLEN(n) (1+n) #else # define VMOPTION(arg) "-"arg # define VMOPTIONOBJ(arg) @"-"arg +# define VMOPTIONLEN(n) (n) #endif usqInt gMaxHeapSize = 512*1024*1024; @@ -222,19 +224,19 @@ - (int) parseArgument: (NSString *) argData peek: (char *) peek return 1; } #if COGVM - if ([argData compare: VMOPTIONOBJ("trace") options: NSLiteralSearch range: NSMakeRange(0,6)] == NSOrderedSame) { + if ([argData compare: VMOPTIONOBJ("trace") options: NSLiteralSearch range: NSMakeRange(0,VMOPTIONLEN(6))] == NSOrderedSame) { extern int traceFlags; - if ([argData length] == 6) { + if ([argData length] == VMOPTIONLEN(6)) { traceFlags = 1; return 1; } - if ([argData length] <= 7 - || [argData characterAtIndex: 6] != '=' - || !isdigit([argData characterAtIndex: 7])) + if ([argData length] <= VMOPTIONLEN(7) + || [argData characterAtIndex: VMOPTIONLEN(6)] != '=' + || !isdigit([argData characterAtIndex: VMOPTIONLEN(7)])) return 0; - traceFlags = atoi([argData UTF8String] + 7); + traceFlags = atoi([argData UTF8String] + VMOPTIONLEN(7)); return 1; } if ([argData isEqualToString: VMOPTIONOBJ("tracestores")]) {