[Scummvm-git-logs] scummvm master -> 9e7bc8e9e68827b11ab2442755ceb944cda5aac6

lephilousophe noreply at scummvm.org
Sat May 3 15:29:40 UTC 2025


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
9e7bc8e9e6 COMMON: Don't use va_list several times


Commit: 9e7bc8e9e68827b11ab2442755ceb944cda5aac6
    https://github.com/scummvm/scummvm/commit/9e7bc8e9e68827b11ab2442755ceb944cda5aac6
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2025-05-03T17:28:34+02:00

Commit Message:
COMMON: Don't use va_list several times

Do a copy of it before passing it to a function calling va_arg.

Changed paths:
    common/str.cpp


diff --git a/common/str.cpp b/common/str.cpp
index 140bad1673f..89c7e6a175c 100644
--- a/common/str.cpp
+++ b/common/str.cpp
@@ -246,11 +246,16 @@ String String::forEachLine(String(*func)(const String, va_list args), ...) const
 	va_list args;
 	va_start(args, func);
 	while (index != npos) {
+		va_list args_;
+		va_copy(args_, args):
+
 		String textLine = substr(prev_index, index - prev_index);
-		textLine = (*func)(textLine, args);
+		textLine = (*func)(textLine, args_);
 		result = result + textLine + '\n';
 		prev_index = index + 1;
 		index = findFirstOf('\n', index + 1);
+
+		va_end(args_);
 	}
 
 	String textLine = substr(prev_index);




More information about the Scummvm-git-logs mailing list