pkgsrc/misc/celestia/patches/patch-ai
dholland ebcd261201 Update to 1.6.1. Reset PKGREVISION from 38 (!).
Upstream changes: 5+ years of development; try these links:
   http://www.shatters.net/celestia/161changes.txt
   http://www.shatters.net/celestia/features/160-features.html
   http://www.shatters.net/celestia/151changes.txt
   http://www.shatters.net/celestia/150-feature-summary.html

Restrictions:
   1. The Lua support still does not build, and given that I had to
      patch it to compile at all with Lua disabled it may not work all
      that well this way.
   2. The optional KDE (kde3) build is almost certainly broken; I will
      get to this in a few days if nobody beats me to it.
2013-10-27 21:21:26 +00:00

32 lines
877 B
Text

$NetBSD: patch-ai,v 1.4 2013/10/27 21:21:26 dholland Exp $
--- src/celestia/celx.cpp.orig 2011-06-05 16:11:13.000000000 +0000
+++ src/celestia/celx.cpp
@@ -492,6 +492,18 @@ static CelestiaCore* getAppCore(lua_Stat
return appCore;
}
+static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) {
+ (void)ud; /* not used */
+ (void)osize; /* not used */
+ if (nsize == 0) {
+ free(ptr); /* ANSI requires that free(NULL) has no effect */
+ return NULL;
+ }
+ else
+ /* ANSI requires that realloc(NULL, size) == malloc(size) */
+ return realloc(ptr, nsize);
+}
+
LuaState::LuaState() :
timeout(MaxTimeslice),
@@ -503,7 +515,7 @@ LuaState::LuaState() :
ioMode(NoIO),
eventHandlerEnabled(false)
{
- state = lua_open();
+ state = lua_newstate(l_alloc, NULL);
timer = CreateTimer();
screenshotCount = 0;
}