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