aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2016-02-02 02:17:43 +0100
committerWillem Jan Palenstijn2016-02-02 02:17:43 +0100
commit658306d005e5c4d3158d0b3d7b5cb7f9a07ea9f2 (patch)
treee4470ddae6ea5e12e011e75e93a072a2383be50d /engines
parent59d2c4b27ed7481eee32578985604d9345e182b2 (diff)
parentad688f9d6f11e576356fb612e9da9ee66d2e1e6b (diff)
downloadscummvm-rg350-658306d005e5c4d3158d0b3d7b5cb7f9a07ea9f2.tar.gz
scummvm-rg350-658306d005e5c4d3158d0b3d7b5cb7f9a07ea9f2.tar.bz2
scummvm-rg350-658306d005e5c4d3158d0b3d7b5cb7f9a07ea9f2.zip
Merge pull request #659 from wjp/sword25_loading
SWORD25: Use more appropriate function for growing the stack
Diffstat (limited to 'engines')
-rw-r--r--engines/sword25/util/lua_persistence_util.cpp9
-rw-r--r--engines/sword25/util/lua_persistence_util.h1
-rw-r--r--engines/sword25/util/lua_unpersist.cpp2
3 files changed, 1 insertions, 11 deletions
diff --git a/engines/sword25/util/lua_persistence_util.cpp b/engines/sword25/util/lua_persistence_util.cpp
index 958fb7ac3c..d0192c2e66 100644
--- a/engines/sword25/util/lua_persistence_util.cpp
+++ b/engines/sword25/util/lua_persistence_util.cpp
@@ -280,15 +280,6 @@ void lua_reallocstack(lua_State *L, int newsize) {
correctStack(L, oldstack);
}
-void lua_growstack(lua_State *L, int n) {
- // Double size is enough?
- if (n <= L->stacksize) {
- lua_reallocstack(L, 2 * L->stacksize);
- } else {
- lua_reallocstack(L, L->stacksize + n);
- }
-}
-
void lua_reallocCallInfo(lua_State *lauState, int newsize) {
CallInfo *oldci = lauState->base_ci;
lua_reallocvector(lauState, lauState->base_ci, lauState->size_ci, newsize, CallInfo);
diff --git a/engines/sword25/util/lua_persistence_util.h b/engines/sword25/util/lua_persistence_util.h
index 4d0085e242..e3a2935f2c 100644
--- a/engines/sword25/util/lua_persistence_util.h
+++ b/engines/sword25/util/lua_persistence_util.h
@@ -90,7 +90,6 @@ void unboxUpValue(lua_State *luaState);
size_t appendStackToStack_reverse(lua_State *from, lua_State *to);
void correctStack(lua_State *L, TValue *oldstack);
void lua_reallocstack(lua_State *L, int newsize);
-void lua_growstack(lua_State *L, int n);
void lua_reallocCallInfo(lua_State *lauState, int newsize);
diff --git a/engines/sword25/util/lua_unpersist.cpp b/engines/sword25/util/lua_unpersist.cpp
index ef0ef31041..678ddb52db 100644
--- a/engines/sword25/util/lua_unpersist.cpp
+++ b/engines/sword25/util/lua_unpersist.cpp
@@ -425,7 +425,7 @@ void unpersistThread(UnSerializationInfo *info, int index) {
// First, deserialize the object stack
uint32 stackSize = info->readStream->readUint32LE();
- lua_growstack(info->luaState, (int)stackSize);
+ lua_checkstack(info->luaState, (int)stackSize);
// Make sure that the first stack element (a nil, representing
// the imaginary top-level C function) is written to the very,