void luaI_strfree (TaggedString *l) { while (l) { TaggedString *next = l->next; luaI_free(l); l = next; } }
/* ** Called to execute RESET opcode, this function pops a function from ** function stack. */ void lua_popfunction (void) { FuncStackNode *temp = funcStack; if (temp == NULL) return; --nfuncstack; lua_debugline = temp->line; funcStack = temp->next; luaI_free(temp); }
/* ** Re-hash */ static void rehash (Hash *t) { int i; int nold = nhash(t); Node *vold = nodevector(t); nhash(t) = luaI_redimension(nhash(t)); nodevector(t) = hashnodecreate(nhash(t)); for (i=0; i<nold; i++) { Node *n = vold+i; if (tag(ref(n)) != LUA_T_NIL && tag(val(n)) != LUA_T_NIL) *node(t, present(t, ref(n))) = *n; /* copy old node to new hahs */ } luaI_free(vold); }
static void grow (stringtable *tb) { int newsize = luaI_redimension(tb->size); TaggedString **newhash = newvector(newsize, TaggedString *); int i; for (i=0; i<newsize; i++) newhash[i] = NULL; /* rehash */ tb->nuse = 0; for (i=0; i<tb->size; i++) if (tb->hash[i] != NULL && tb->hash[i] != &EMPTY) { int h = tb->hash[i]->hash%newsize; while (newhash[h]) h = (h+1)%newsize; newhash[h] = tb->hash[i]; tb->nuse++; } luaI_free(tb->hash); tb->size = newsize; tb->hash = newhash; }
int lua_domain (void) { TFunc tf; int status; jmp_buf myErrorJmp; jmp_buf *oldErr = errorJmp; errorJmp = &myErrorJmp; luaI_initTFunc(&tf); if (setjmp(myErrorJmp) == 0) { lua_parse(&tf); status = 0; } else { adjustC(0); /* erase extra slot */ status = 1; } if (status == 0) status = luaI_dorun(&tf); errorJmp = oldErr; luaI_free(tf.code); return status; }
static int do_protectedmain (void) { TFunc tf; int status; jmp_buf myErrorJmp; jmp_buf *oldErr = errorJmp; errorJmp = &myErrorJmp; luaI_initTFunc(&tf); tf.fileName = lua_parsedfile; if (setjmp(myErrorJmp) == 0) { lua_parse(&tf); status = luaI_dorun(&tf); } else { status = 1; adjustC(0); /* erase extra slot */ } errorJmp = oldErr; luaI_free(tf.code); return status; }
/* ** Delete a hash */ static void hashdelete (Hash *t) { luaI_free (nodevector(t)); luaI_free(t); }