diff options
-rw-r--r-- | bugs | 42 |
1 files changed, 40 insertions, 2 deletions
@@ -3680,9 +3680,9 @@ It needs an "interceptor" 'memcmp' function that continues | |||
3680 | reading memory after a difference is found.]], | 3680 | reading memory after a difference is found.]], |
3681 | patch = [[ | 3681 | patch = [[ |
3682 | 2c2 | 3682 | 2c2 |
3683 | < ** $Id: bugs,v 1.159 2017/12/13 18:35:03 roberto Exp roberto $ | 3683 | < ** $Id: bugs,v 1.160 2018/05/24 20:25:14 roberto Exp roberto $ |
3684 | --- | 3684 | --- |
3685 | > ** $Id: bugs,v 1.159 2017/12/13 18:35:03 roberto Exp roberto $ | 3685 | > ** $Id: bugs,v 1.160 2018/05/24 20:25:14 roberto Exp roberto $ |
3686 | 263c263,264 | 3686 | 263c263,264 |
3687 | < for (option = LUA_STRFTIMEOPTIONS; *option != '\0'; option += oplen) { | 3687 | < for (option = LUA_STRFTIMEOPTIONS; *option != '\0'; option += oplen) { |
3688 | --- | 3688 | --- |
@@ -3974,6 +3974,44 @@ pcall(rawset, a, 2, 20) -- forces a rehash | |||
3974 | for k,v in pairs(a) do print(k,v) end | 3974 | for k,v in pairs(a) do print(k,v) end |
3975 | ]], | 3975 | ]], |
3976 | patch = [[ | 3976 | patch = [[ |
3977 | --- ltable.c 2018/05/24 19:39:05 2.118.1.3 | ||
3978 | +++ ltable.c 2018/06/04 16:00:25 | ||
3979 | @@ -332,17 +332,34 @@ | ||
3980 | } | ||
3981 | |||
3982 | |||
3983 | +typedef struct { | ||
3984 | + Table *t; | ||
3985 | + unsigned int nhsize; | ||
3986 | +} AuxsetnodeT; | ||
3987 | + | ||
3988 | + | ||
3989 | +static void auxsetnode (lua_State *L, void *ud) { | ||
3990 | + AuxsetnodeT *asn = cast(AuxsetnodeT *, ud); | ||
3991 | + setnodevector(L, asn->t, asn->nhsize); | ||
3992 | +} | ||
3993 | + | ||
3994 | + | ||
3995 | void luaH_resize (lua_State *L, Table *t, unsigned int nasize, | ||
3996 | unsigned int nhsize) { | ||
3997 | unsigned int i; | ||
3998 | int j; | ||
3999 | + AuxsetnodeT asn; | ||
4000 | unsigned int oldasize = t->sizearray; | ||
4001 | int oldhsize = allocsizenode(t); | ||
4002 | Node *nold = t->node; /* save old hash ... */ | ||
4003 | if (nasize > oldasize) /* array part must grow? */ | ||
4004 | setarrayvector(L, t, nasize); | ||
4005 | /* create new hash part with appropriate size */ | ||
4006 | - setnodevector(L, t, nhsize); | ||
4007 | + asn.t = t; asn.nhsize = nhsize; | ||
4008 | + if (luaD_rawrunprotected(L, auxsetnode, &asn) != LUA_OK) { /* mem. error? */ | ||
4009 | + setarrayvector(L, t, oldasize); /* array back to its original size */ | ||
4010 | + luaD_throw(L, LUA_ERRMEM); /* rethrow memory error */ | ||
4011 | + } | ||
4012 | if (nasize < oldasize) { /* array part must shrink? */ | ||
4013 | t->sizearray = nasize; | ||
4014 | /* re-insert elements from vanishing slice */ | ||
3977 | ]] | 4015 | ]] |
3978 | } | 4016 | } |
3979 | 4017 | ||