Example #1
0
void kp_obj_free_gclist(ktap_state *ks, ktap_gcobject *o)
{
	while (o) {
		ktap_gcobject *next;

		next = gch(o)->next;
		switch (gch(o)->tt) {
		case KTAP_TYPE_TABLE:
			kp_tab_free(ks, (ktap_tab *)o);
			break;
		case KTAP_TYPE_PROTO:
			free_proto(ks, (ktap_proto *)o);
			break;
		case KTAP_TYPE_UPVAL:
			kp_freeupval(ks, (ktap_upval *)o);
			break;
		case KTAP_TYPE_PTABLE:
			kp_ptab_free(ks, (ktap_ptab *)o);
			break;
		case KTAP_TYPE_RAW:
			kp_free(ks, ((ktap_rawobj *)o)->v);
			break;
		default:
			kp_free(ks, o);
		}
		o = next;
	}
}
Example #2
0
void kp_free_all_gcobject(ktap_State *ks)
{
	Gcobject *o = G(ks)->allgc;
	Gcobject *next;

	while (o) {
		next = gch(o)->next;
		switch (gch(o)->tt) {
		case KTAP_TTABLE:
			kp_table_free(ks, (Table *)o);
			break;
		case KTAP_TPROTO:
			free_proto(ks, (Proto *)o);
			break;
		default:
			kp_free(ks, o);
		}
		o = next;
	}

	G(ks)->allgc = NULL;
}
Example #3
0
void kp_free_gclist(ktap_state *ks, ktap_gcobject *o)
{
	while (o) {
		ktap_gcobject *next;

		next = gch(o)->next;
		switch (gch(o)->tt) {
		case KTAP_TTABLE:
			kp_table_free(ks, (ktap_table *)o);
			break;
		case KTAP_TPROTO:
			free_proto(ks, (ktap_proto *)o);
			break;
#ifdef __KERNEL__
		case KTAP_TPTABLE:
			kp_ptable_free(ks, (ktap_ptable *)o);
			break;
#endif
		default:
			kp_free(ks, o);
		}
		o = next;
	}
}