components/lua/patches/4.src.patch
author Srinivasa Sarva <srinivasa.sarva@oracle.com>
Fri, 14 Oct 2011 10:06:55 -0700
changeset 535 5fca86890b48
permissions -rw-r--r--
7100733 Include Lua 5.1.4 patch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
535
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
     1
--- lua-5.1.4/src/lcode.c	2007/12/28 15:32:23	2.25.1.3
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
     2
+++ lua-5.1.4/src/lcode.c	2011/01/31 14:53:16	2.25.1.5
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
     3
@@ -1,5 +1,5 @@
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
     4
 /*
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
     5
-** $Id: lcode.c,v 2.25.1.3 2007/12/28 15:32:23 roberto Exp $
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
     6
+** $Id: lcode.c,v 2.25.1.5 2011/01/31 14:53:16 roberto Exp $
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
     7
 ** Code generator for Lua
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
     8
 ** See Copyright Notice in lua.h
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
     9
 */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    10
@@ -544,10 +544,6 @@
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    11
       pc = NO_JUMP;  /* always true; do nothing */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    12
       break;
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    13
     }
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    14
-    case VFALSE: {
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    15
-      pc = luaK_jump(fs);  /* always jump */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    16
-      break;
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    17
-    }
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    18
     case VJMP: {
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    19
       invertjump(fs, e);
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    20
       pc = e->u.s.info;
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    21
@@ -572,10 +568,6 @@
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    22
       pc = NO_JUMP;  /* always false; do nothing */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    23
       break;
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    24
     }
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    25
-    case VTRUE: {
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    26
-      pc = luaK_jump(fs);  /* always jump */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    27
-      break;
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    28
-    }
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    29
     case VJMP: {
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    30
       pc = e->u.s.info;
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    31
       break;
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    32
--- lua-5.1.4/src/ldblib.c	2008/01/21 13:11:21	1.104.1.3
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    33
+++ lua-5.1.4/src/ldblib.c	2009/08/04 18:50:18	1.104.1.4
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    34
@@ -1,5 +1,5 @@
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    35
 /*
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    36
-** $Id: ldblib.c,v 1.104.1.3 2008/01/21 13:11:21 roberto Exp $
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    37
+** $Id: ldblib.c,v 1.104.1.4 2009/08/04 18:50:18 roberto Exp $
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    38
 ** Interface from Lua to its debug API
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    39
 ** See Copyright Notice in lua.h
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    40
 */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    41
@@ -45,6 +45,7 @@
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    42
 
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    43
 
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    44
 static int db_getfenv (lua_State *L) {
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    45
+  luaL_checkany(L, 1);
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    46
   lua_getfenv(L, 1);
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    47
   return 1;
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    48
 }
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    49
--- lua-5.1.4/src/liolib.c	2008/01/18 17:47:43	2.73.1.3
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    50
+++ lua-5.1.4/src/liolib.c	2010/05/14 15:33:51	2.73.1.4
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    51
@@ -1,5 +1,5 @@
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    52
 /*
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    53
-** $Id: liolib.c,v 2.73.1.3 2008/01/18 17:47:43 roberto Exp $
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    54
+** $Id: liolib.c,v 2.73.1.4 2010/05/14 15:33:51 roberto Exp $
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    55
 ** Standard I/O (and system) library
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    56
 ** See Copyright Notice in lua.h
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    57
 */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    58
@@ -276,7 +276,10 @@
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    59
     lua_pushnumber(L, d);
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    60
     return 1;
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    61
   }
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    62
-  else return 0;  /* read fails */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    63
+  else {
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    64
+    lua_pushnil(L);  /* "result" to be removed */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    65
+    return 0;  /* read fails */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    66
+  }
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    67
 }
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    68
 
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    69
 
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    70
--- lua-5.1.4/src/llex.c	2007/12/27 13:02:25	2.20.1.1
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    71
+++ lua-5.1.4/src/llex.c	2009/11/23 14:58:22	2.20.1.2
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    72
@@ -1,5 +1,5 @@
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    73
 /*
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    74
-** $Id: llex.c,v 2.20.1.1 2007/12/27 13:02:25 roberto Exp $
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    75
+** $Id: llex.c,v 2.20.1.2 2009/11/23 14:58:22 roberto Exp $
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    76
 ** Lexical Analyzer
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    77
 ** See Copyright Notice in lua.h
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    78
 */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    79
@@ -118,8 +118,10 @@
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    80
   lua_State *L = ls->L;
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    81
   TString *ts = luaS_newlstr(L, str, l);
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    82
   TValue *o = luaH_setstr(L, ls->fs->h, ts);  /* entry for `str' */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    83
-  if (ttisnil(o))
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    84
+  if (ttisnil(o)) {
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    85
     setbvalue(o, 1);  /* make sure `str' will not be collected */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    86
+    luaC_checkGC(L);
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    87
+  }
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    88
   return ts;
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    89
 }
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    90
 
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    91
--- lua-5.1.4/src/loadlib.c	2008/08/06 13:29:28	1.52.1.3
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    92
+++ lua-5.1.4/src/loadlib.c	2009/09/09 13:17:16	1.52.1.4
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    93
@@ -1,5 +1,5 @@
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    94
 /*
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    95
-** $Id: loadlib.c,v 1.52.1.3 2008/08/06 13:29:28 roberto Exp $
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    96
+** $Id: loadlib.c,v 1.52.1.4 2009/09/09 13:17:16 roberto Exp $
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    97
 ** Dynamic library loader for Lua
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    98
 ** See Copyright Notice in lua.h
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
    99
 **
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   100
@@ -639,7 +639,7 @@
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   101
   lua_pushvalue(L, -1);
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   102
   lua_replace(L, LUA_ENVIRONINDEX);
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   103
   /* create `loaders' table */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   104
-  lua_createtable(L, 0, sizeof(loaders)/sizeof(loaders[0]) - 1);
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   105
+  lua_createtable(L, sizeof(loaders)/sizeof(loaders[0]) - 1, 0);
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   106
   /* fill it with pre-defined loaders */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   107
   for (i=0; loaders[i] != NULL; i++) {
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   108
     lua_pushcfunction(L, loaders[i]);
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   109
--- lua-5.1.4/src/lstrlib.c	2008/07/11 17:27:21	1.132.1.4
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   110
+++ lua-5.1.4/src/lstrlib.c	2010/05/14 15:34:19	1.132.1.5
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   111
@@ -1,5 +1,5 @@
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   112
 /*
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   113
-** $Id: lstrlib.c,v 1.132.1.4 2008/07/11 17:27:21 roberto Exp $
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   114
+** $Id: lstrlib.c,v 1.132.1.5 2010/05/14 15:34:19 roberto Exp $
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   115
 ** Standard library for string operations and pattern-matching
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   116
 ** See Copyright Notice in lua.h
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   117
 */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   118
@@ -754,6 +754,7 @@
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   119
 
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   120
 
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   121
 static int str_format (lua_State *L) {
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   122
+  int top = lua_gettop(L);
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   123
   int arg = 1;
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   124
   size_t sfl;
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   125
   const char *strfrmt = luaL_checklstring(L, arg, &sfl);
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   126
@@ -768,7 +769,8 @@
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   127
     else { /* format item */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   128
       char form[MAX_FORMAT];  /* to store the format (`%...') */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   129
       char buff[MAX_ITEM];  /* to store the formatted item */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   130
-      arg++;
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   131
+      if (++arg > top)
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   132
+        luaL_argerror(L, arg, "no value");
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   133
       strfrmt = scanformat(L, strfrmt, form);
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   134
       switch (*strfrmt++) {
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   135
         case 'c': {
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   136
--- lua-5.1.4/src/lvm.c	2007/12/28 15:32:23	2.63.1.3
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   137
+++ lua-5.1.4/src/lvm.c	2009/07/01 21:10:33	2.63.1.4
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   138
@@ -1,5 +1,5 @@
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   139
 /*
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   140
-** $Id: lvm.c,v 2.63.1.3 2007/12/28 15:32:23 roberto Exp $
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   141
+** $Id: lvm.c,v 2.63.1.4 2009/07/01 21:10:33 roberto Exp $
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   142
 ** Lua virtual machine
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   143
 ** See Copyright Notice in lua.h
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   144
 */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   145
@@ -133,6 +133,7 @@
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   146
 
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   147
 void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) {
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   148
   int loop;
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   149
+  TValue temp;
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   150
   for (loop = 0; loop < MAXTAGLOOP; loop++) {
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   151
     const TValue *tm;
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   152
     if (ttistable(t)) {  /* `t' is a table? */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   153
@@ -152,7 +153,9 @@
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   154
       callTM(L, tm, t, key, val);
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   155
       return;
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   156
     }
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   157
-    t = tm;  /* else repeat with `tm' */ 
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   158
+    /* else repeat with `tm' */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   159
+    setobj(L, &temp, tm);  /* avoid pointing inside table (may rehash) */
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   160
+    t = &temp;
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   161
   }
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   162
   luaG_runerror(L, "loop in settable");
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   163
 }
5fca86890b48 7100733 Include Lua 5.1.4 patch
Srinivasa Sarva <srinivasa.sarva@oracle.com>
parents:
diff changeset
   164