[Scummvm-git-logs] scummvm master -> 419055abc0adfa4de4045e6fb026d08c3a3a0fc2

bluegr noreply at scummvm.org
Sun May 18 06:59:42 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:
419055abc0 GRIM: LUA: Avoid unnecessary calls for empty string concatenation


Commit: 419055abc0adfa4de4045e6fb026d08c3a3a0fc2
    https://github.com/scummvm/scummvm/commit/419055abc0adfa4de4045e6fb026d08c3a3a0fc2
Author: Orgad Shaneh (orgads at gmail.com)
Date: 2025-05-18T09:59:39+03:00

Commit Message:
GRIM: LUA: Avoid unnecessary calls for empty string concatenation

addnchar is effectively no-op for n==0, and it calls strncpy with 0, which
is also redundant.

Changed paths:
    engines/grim/lua/lstrlib.cpp


diff --git a/engines/grim/lua/lstrlib.cpp b/engines/grim/lua/lstrlib.cpp
index dec30476adc..d088026d6b0 100644
--- a/engines/grim/lua/lstrlib.cpp
+++ b/engines/grim/lua/lstrlib.cpp
@@ -29,7 +29,8 @@ static void addnchar(const char *s, int32 n) {
 #endif
 
 static void addstr(const char *s) {
-	addnchar(s, strlen(s));
+	if (*s)
+		addnchar(s, strlen(s));
 }
 
 static void str_len() {




More information about the Scummvm-git-logs mailing list