Ejemplo n.º 1
0
/* sortlist */
extern List *sortlist(List *list) {
    if (length(list) > 1) {
        Vector *v = vectorize(list);
        sortvector(v);
        gcdisable(0);
        Ref(List *, lp, listify(v->count, v->vector));
        gcenable();
        list = lp;
        RefEnd(lp);
    }
Ejemplo n.º 2
0
extern Vector *mkenv(void) {
	if (isdirty || rebound) {
		env->count = envmin;
		gcdisable();		/* TODO: make this a good guess */
		dictforall(vars, mkenv0, NULL);
		gcenable();
		env->vector[env->count] = NULL;
		isdirty = FALSE;
		rebound = FALSE;
		if (sortenv == NULL || env->count > sortenv->alloclen)
			sortenv = mkvector(env->count * 2);
		sortenv->count = env->count;
		memcpy(sortenv->vector, env->vector, sizeof (char *) * (env->count + 1));
		sortvector(sortenv);
	}
	return sortenv;
}