bool desc_ring_set_size(DescRing *ring, uint32_t size)

{

    int i;



    if (size < 2 || size > 0x10000 || (size & (size - 1))) {

        DPRINTF("ERROR: ring[%d] size (%d) not a power of 2 "

                "or in range [2, 64K]\n", ring->index, size);

        return false;

    }



    for (i = 0; i < ring->size; i++) {

        if (ring->info[i].buf) {

            g_free(ring->info[i].buf);

        }

    }



    ring->size = size;

    ring->head = ring->tail = 0;



    ring->info = g_realloc(ring->info, size * sizeof(DescInfo));

    if (!ring->info) {

        return false;

    }



    memset(ring->info, 0, size * sizeof(DescInfo));



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

        ring->info[i].ring = ring;

    }



    return true;

}

bool desc_ring_set_size(DescRing *ring, uint32_t size)

{

    int i;



    if (size < 2 || size > 0x10000 || (size & (size - 1))) {

        DPRINTF("ERROR: ring[%d] size (%d) not a power of 2 "

                "or in range [2, 64K]\n", ring->index, size);

        return false;

    }



    for (i = 0; i < ring->size; i++) {

        if (ring->info[i].buf) {

            g_free(ring->info[i].buf);

        }

    }



    ring->size = size;

    ring->head = ring->tail = 0;



    ring->info = g_realloc(ring->info, size * sizeof(DescInfo));

    if (!ring->info) {

        return false;

    }



    memset(ring->info, 0, size * sizeof(DescInfo));



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

        ring->info[i].ring = ring;

    }



    return true;

}

bool FUNC_0(DescRing *ring, uint32_t size)

{

    int VAR_0;



    if (size < 2 || size > 0x10000 || (size & (size - 1))) {

        DPRINTF("ERROR: ring[%d] size (%d) not a power of 2 "

                "or in range [2, 64K]\n", ring->index, size);

        return false;

    }



    for (VAR_0 = 0; VAR_0 < ring->size; VAR_0++) {

        if (ring->info[VAR_0].buf) {

            g_free(ring->info[VAR_0].buf);

        }

    }



    ring->size = size;

    ring->head = ring->tail = 0;



    ring->info = g_realloc(ring->info, size * sizeof(DescInfo));

    if (!ring->info) {

        return false;

    }



    memset(ring->info, 0, size * sizeof(DescInfo));



    for (VAR_0 = 0; VAR_0 < size; VAR_0++) {

        ring->info[VAR_0].ring = ring;

    }



    return true;

}

bool FUNC_0(DescRing *ring, uint32_t size)
{ int VAR_0; if (size < 2 || size > 0x10000 || (size & (size - 1))) { DPRINTF("ERROR: ring[%d] size (%d) not a power of 2 "
"or in range [2, 64K]\n", ring->index, size); return false; } for (VAR_0 = 0; VAR_0 < ring->size; VAR_0++) { if (ring->info[VAR_0].buf) { g_free(ring->info[VAR_0].buf); } } ring->size = size; ring->head = ring->tail = 0; ring->info = g_realloc(ring->info, size * sizeof(DescInfo)); if (!ring->info) { return false; } memset(ring->info, 0, size * sizeof(DescInfo)); for (VAR_0 = 0; VAR_0 < size; VAR_0++) { ring->info[VAR_0].ring = ring; } return true; }