Skip to content

Commit

Permalink
Improve sprintf() and lsprintf() runtime performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Pieter12345 committed Dec 27, 2024
1 parent f828f47 commit f753951
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1434,15 +1434,16 @@ public Mixed exec(Target t, Environment environment, Mixed... args) throws Confi
}
}

if(requiredArgs(parsed) != flattenedArgs.size()) {
int requiredArgs = requiredArgs(parsed);
if(requiredArgs != flattenedArgs.size()) {
throw new CREInsufficientArgumentsException("The specified format string: \"" + formatString + "\""
+ " expects " + requiredArgs(parsed) + " argument(s),"
+ " expects " + requiredArgs + " argument(s),"
+ " but " + flattenedArgs.size() + " were provided.", t);
}

//Now figure out how to cast things, now that we know our argument numbers will match up
Object[] params = new Object[flattenedArgs.size()];
for(int i = 0; i < requiredArgs(parsed); i++) {
for(int i = 0; i < requiredArgs; i++) {
Mixed arg = flattenedArgs.get(i);
FormatString fs = parsed.get(i);
Character c = fs.getExpectedType();
Expand Down

0 comments on commit f753951

Please sign in to comment.