Browse Source

BUG: lua_newtag can be called before luaI_IMtable is initialized.

v5-2
Roberto Ierusalimschy 28 years ago
parent
commit
ae067dcddd
  1. 8
      fallback.c

8
fallback.c

@ -3,7 +3,7 @@
** TecCGraf - PUC-Rio
*/
char *rcs_fallback="$Id: fallback.c,v 1.29 1997/03/19 21:12:34 roberto Exp roberto $";
char *rcs_fallback="$Id: fallback.c,v 1.30 1997/03/20 19:20:43 roberto Exp roberto $";
#include <stdio.h>
#include <string.h>
@ -174,6 +174,7 @@ static void init_entry (int tag)
void luaI_initfallbacks (void)
{
if (luaI_IMtable == NULL) {
int i;
IMtable_size = NUM_TYPES+10;
luaI_IMtable = newvector(IMtable_size, struct IM);
@ -182,14 +183,17 @@ void luaI_initfallbacks (void)
init_entry(i);
}
}
}
int lua_newtag (char *t)
{
int tp;
--last_tag;
if ((-last_tag) >= IMtable_size)
if ((-last_tag) >= IMtable_size) {
luaI_initfallbacks();
IMtable_size = growvector(&luaI_IMtable, IMtable_size,
struct IM, memEM, MAX_INT);
}
tp = -findstring(t, typenames);
if (tp == LUA_T_ARRAY || tp == LUA_T_USERDATA)
luaI_IMtable[-last_tag].tp = tp;

Loading…
Cancel
Save