예제 #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);
    }
예제 #2
0
파일: var.c 프로젝트: Dioxylin/es-shell
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;
}