Exemplo n.º 1
0
void enclave_main()
{
    sgx_debug("qsort test\n");

    sgx_qsort(values, 6, sizeof(int), compare);

    sgx_printf("%d %d %d %d %d %d\n", values[0], values[1], values[2], values[3], values[4], values[5]);

    sgx_exit(NULL);
}
Exemplo n.º 2
0
void sk_sort(_STACK *st)
{
    if (st && !st->sorted) {
        int (*comp_func) (const void *, const void *);

        /*
         * same comment as in sk_find ... previously st->comp was declared as
         * a (void*,void*) callback type, but this made the population of the
         * callback pointer illogical - our callbacks compare type** with
         * type**, so we leave the casting until absolutely necessary (ie.
         * "now").
         */
        comp_func = (int (*)(const void *, const void *))(st->comp);
        sgx_qsort(st->data, st->num, sizeof(char *), comp_func);
        st->sorted = 1;
    }
}