Author: cazfi
Date: Tue Mar  3 18:34:10 2015
New Revision: 28380

URL: http://svn.gna.org/viewcvs/freeciv?rev=28380&view=rev
Log:
Applied lua.org patches 1 and 2 to included lua-5.3.0

See patch #5878

Modified:
    trunk/dependencies/lua-5.3/Version
    trunk/dependencies/lua-5.3/src/ldebug.c
    trunk/dependencies/lua-5.3/src/lstrlib.c

Modified: trunk/dependencies/lua-5.3/Version
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/dependencies/lua-5.3/Version?rev=28380&r1=28379&r2=28380&view=diff
==============================================================================
--- trunk/dependencies/lua-5.3/Version  (original)
+++ trunk/dependencies/lua-5.3/Version  Tue Mar  3 18:34:10 2015
@@ -1,4 +1,6 @@
 Sources here are from lua-5.3.0 (http://www.lua.org/ftp/lua-5.3.0.tar.gz)
+All applicable official lua.org patches, as of 01-Mar-15, have been applied.
+That's patches 1-2.
 
 Not entire lua distribution directory hierarchy is included here, and
 some files needed for Freeciv usage have been added.

Modified: trunk/dependencies/lua-5.3/src/ldebug.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/dependencies/lua-5.3/src/ldebug.c?rev=28380&r1=28379&r2=28380&view=diff
==============================================================================
--- trunk/dependencies/lua-5.3/src/ldebug.c     (original)
+++ trunk/dependencies/lua-5.3/src/ldebug.c     Tue Mar  3 18:34:10 2015
@@ -48,6 +48,16 @@
 }
 
 
+static void swapextra (lua_State *L) {
+  if (L->status == LUA_YIELD) {
+    CallInfo *ci = L->ci;  /* get function that yielded */
+    StkId temp = ci->func;  /* exchange its 'func' and 'extra' values */
+    ci->func = restorestack(L, ci->extra);
+    ci->extra = savestack(L, temp);
+  }
+}
+
+
 /*
 ** this function can be called asynchronous (e.g. during a signal)
 */
@@ -144,6 +154,7 @@
 LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {
   const char *name;
   lua_lock(L);
+  swapextra(L);
   if (ar == NULL) {  /* information about non-active function? */
     if (!isLfunction(L->top - 1))  /* not a Lua function? */
       name = NULL;
@@ -158,6 +169,7 @@
       api_incr_top(L);
     }
   }
+  swapextra(L);
   lua_unlock(L);
   return name;
 }
@@ -165,12 +177,15 @@
 
 LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) {
   StkId pos = 0;  /* to avoid warnings */
-  const char *name = findlocal(L, ar->i_ci, n, &pos);
+  const char *name;
   lua_lock(L);
+  swapextra(L);
+  name = findlocal(L, ar->i_ci, n, &pos);
   if (name) {
     setobjs2s(L, pos, L->top - 1);
     L->top--;  /* pop value */
   }
+  swapextra(L);
   lua_unlock(L);
   return name;
 }
@@ -270,6 +285,7 @@
   CallInfo *ci;
   StkId func;
   lua_lock(L);
+  swapextra(L);
   if (*what == '>') {
     ci = NULL;
     func = L->top - 1;
@@ -288,6 +304,7 @@
     setobjs2s(L, L->top, func);
     api_incr_top(L);
   }
+  swapextra(L);
   if (strchr(what, 'L'))
     collectvalidlines(L, cl);
   lua_unlock(L);

Modified: trunk/dependencies/lua-5.3/src/lstrlib.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/dependencies/lua-5.3/src/lstrlib.c?rev=28380&r1=28379&r2=28380&view=diff
==============================================================================
--- trunk/dependencies/lua-5.3/src/lstrlib.c    (original)
+++ trunk/dependencies/lua-5.3/src/lstrlib.c    Tue Mar  3 18:34:10 2015
@@ -798,7 +798,8 @@
 */
 
 /* maximum size of each formatted item (> len(format('%99.99f', -1e308))) */
-#define MAX_ITEM       512
+#define MAX_ITEM  \
+  (sizeof(lua_Number) <= 4 ? 150 : sizeof(lua_Number) <= 8 ? 450 : 5050)
 
 /* valid flags in a format specification */
 #define FLAGS  "-+ #0"


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to