X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/aeb295b7e75208d59fe2a3f9bafb04403e6bca4d..9777bd50251d7e72c44bfbee7fbad2d8df148e47:/Replace.cpp diff --git a/Replace.cpp b/Replace.cpp index 8023bdb..5803478 100644 --- a/Replace.cpp +++ b/Replace.cpp @@ -453,10 +453,7 @@ namespace cy { namespace Syntax { CYExpression *New::AddArgument(CYContext &context, CYExpression *value) { - CYArgument **argument(&arguments_); - while (*argument != NULL) - argument = &(*argument)->next_; - *argument = $ CYArgument(value); + CYSetLast(arguments_, $ CYArgument(value)); return this; } @@ -549,8 +546,8 @@ void CYProgram::Replace(CYContext &context) { IdentifierUsages usages; if (offset < context.rename_.size()) - for (CYIdentifier *i(context.rename_[offset].identifier_); i != NULL; i = i->next_) - usages.insert(i); + CYForEach (i, context.rename_[offset].identifier_) + usages.insert(i); // XXX: totalling the probable occurrences and sorting by them would improve the result for (CYIdentifierUsageVector::const_iterator i(context.rename_.begin()); i != context.rename_.end(); ++i, ++offset) { @@ -582,7 +579,7 @@ void CYProgram::Replace(CYContext &context) { // XXX: at some point, this could become a keyword } - for (CYIdentifier *identifier(i->identifier_); identifier != NULL; identifier = identifier->next_) + CYForEach (identifier, i->identifier_) identifier->Set(name); } }