diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-04 16:38:35 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-04 16:38:35 -0300 |
commit | 435f587ed05e2c4d542e1db9ae9e4efbb7e02305 (patch) | |
tree | 1b179bf836cfdaf8ed74df24c2d22cda8f07aaa9 /ltm.c | |
parent | ae55f3eeada102f3fa8345173410feaf1db42cde (diff) | |
download | lua-435f587ed05e2c4d542e1db9ae9e4efbb7e02305.tar.gz lua-435f587ed05e2c4d542e1db9ae9e4efbb7e02305.tar.bz2 lua-435f587ed05e2c4d542e1db9ae9e4efbb7e02305.zip |
(much) better handling of memory alloction errors
Diffstat (limited to 'ltm.c')
-rw-r--r-- | ltm.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltm.c,v 1.42 2000/06/08 17:48:31 roberto Exp roberto $ | 2 | ** $Id: ltm.c,v 1.43 2000/06/12 13:52:05 roberto Exp roberto $ |
3 | ** Tag methods | 3 | ** Tag methods |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -69,17 +69,17 @@ static void init_entry (lua_State *L, int tag) { | |||
69 | 69 | ||
70 | void luaT_init (lua_State *L) { | 70 | void luaT_init (lua_State *L) { |
71 | int t; | 71 | int t; |
72 | L->last_tag = NUM_TAGS-1; | ||
73 | luaM_growvector(L, L->IMtable, 0, NUM_TAGS, struct IM, "", MAX_INT); | 72 | luaM_growvector(L, L->IMtable, 0, NUM_TAGS, struct IM, "", MAX_INT); |
73 | L->last_tag = NUM_TAGS-1; | ||
74 | for (t=0; t<=L->last_tag; t++) | 74 | for (t=0; t<=L->last_tag; t++) |
75 | init_entry(L, t); | 75 | init_entry(L, t); |
76 | } | 76 | } |
77 | 77 | ||
78 | 78 | ||
79 | int lua_newtag (lua_State *L) { | 79 | int lua_newtag (lua_State *L) { |
80 | ++L->last_tag; | ||
81 | luaM_growvector(L, L->IMtable, L->last_tag, 1, struct IM, | 80 | luaM_growvector(L, L->IMtable, L->last_tag, 1, struct IM, |
82 | "tag table overflow", MAX_INT); | 81 | "tag table overflow", MAX_INT); |
82 | L->last_tag++; | ||
83 | init_entry(L, L->last_tag); | 83 | init_entry(L, L->last_tag); |
84 | return L->last_tag; | 84 | return L->last_tag; |
85 | } | 85 | } |