@@ -83,12 +83,13 @@ } } #endif static bool -evaluateCondition(OFString *condition, OFDictionary *variables) +evaluateCondition(OFString *condition_, OFDictionary *variables) { + OFMutableString *condition = [[condition_ mutableCopy] autorelease]; OFMutableArray *tokens, *operators, *stack; /* Empty condition is the fallback that's always true */ if (condition.length == 0) return true; @@ -96,16 +97,13 @@ /* * Dirty hack to allow not needing spaces after "!" or "(" and spaces * before ")". * TODO: Replace with a proper tokenizer. */ - condition = [condition stringByReplacingOccurrencesOfString: @"!" - withString: @"! "]; - condition = [condition stringByReplacingOccurrencesOfString: @"(" - withString: @"( "]; - condition = [condition stringByReplacingOccurrencesOfString: @")" - withString: @" )"]; + [condition replaceOccurrencesOfString: @"!" withString: @"! "]; + [condition replaceOccurrencesOfString: @"(" withString: @"( "]; + [condition replaceOccurrencesOfString: @")" withString: @" )"]; /* Substitute variables and convert to RPN first */ tokens = [OFMutableArray array]; operators = [OFMutableArray array]; for (OFString *token in [condition