void bdrv_iterate_format(void (*it)(void *opaque, const char *name),

                         void *opaque)

{

    BlockDriver *drv;

    int count = 0;

    int i;

    const char **formats = NULL;



    QLIST_FOREACH(drv, &bdrv_drivers, list) {

        if (drv->format_name) {

            bool found = false;

            int i = count;

            while (formats && i && !found) {

                found = !strcmp(formats[--i], drv->format_name);

            }



            if (!found) {

                formats = g_renew(const char *, formats, count + 1);

                formats[count++] = drv->format_name;

            }

        }

    }



    qsort(formats, count, sizeof(formats[0]), qsort_strcmp);



    for (i = 0; i < count; i++) {

        it(opaque, formats[i]);

    }



    g_free(formats);

}

void bdrv_iterate_format(void (*it)(void *opaque, const char *name),

                         void *opaque)

{

    BlockDriver *drv;

    int count = 0;

    int i;

    const char **formats = NULL;



    QLIST_FOREACH(drv, &bdrv_drivers, list) {

        if (drv->format_name) {

            bool found = false;

            int i = count;

            while (formats && i && !found) {

                found = !strcmp(formats[--i], drv->format_name);

            }



            if (!found) {

                formats = g_renew(const char *, formats, count + 1);

                formats[count++] = drv->format_name;

            }

        }

    }



    qsort(formats, count, sizeof(formats[0]), qsort_strcmp);



    for (i = 0; i < count; i++) {

        it(opaque, formats[i]);

    }



    g_free(formats);

}

void FUNC_0(void (*VAR_0)(void *VAR_3, const char *VAR_2),

                         void *VAR_3)

{

    BlockDriver *drv;

    int VAR_3 = 0;

    int VAR_4;

    const char **VAR_5 = NULL;



    QLIST_FOREACH(drv, &bdrv_drivers, list) {

        if (drv->format_name) {

            bool found = false;

            int VAR_4 = VAR_3;

            while (VAR_5 && VAR_4 && !found) {

                found = !strcmp(VAR_5[--VAR_4], drv->format_name);

            }



            if (!found) {

                VAR_5 = g_renew(const char *, VAR_5, VAR_3 + 1);

                VAR_5[VAR_3++] = drv->format_name;

            }

        }

    }



    qsort(VAR_5, VAR_3, sizeof(VAR_5[0]), qsort_strcmp);



    for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) {

        VAR_0(VAR_3, VAR_5[VAR_4]);

    }



    g_free(VAR_5);

}

void FUNC_0(void (*VAR_0)(void *VAR_3, const char *VAR_2),
void *VAR_3)
{ BlockDriver *drv; int VAR_3 = 0; int VAR_4; const char **VAR_5 = NULL; QLIST_FOREACH(drv, &bdrv_drivers, list) { if (drv->format_name) { bool found = false; int VAR_4 = VAR_3; while (VAR_5 && VAR_4 && !found) { found = !strcmp(VAR_5[--VAR_4], drv->format_name); } if (!found) { VAR_5 = g_renew(const char *, VAR_5, VAR_3 + 1); VAR_5[VAR_3++] = drv->format_name; } } } qsort(VAR_5, VAR_3, sizeof(VAR_5[0]), qsort_strcmp); for (VAR_4 = 0; VAR_4 < VAR_3; VAR_4++) { VAR_0(VAR_3, VAR_5[VAR_4]); } g_free(VAR_5); }