[MPlayer-dev-eng] [PATCH] Dynamic list of EOSD sources

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Sep 14 20:47:20 CEST 2010


On Sun, Sep 12, 2010 at 09:11:23PM +0200, Nicolas George wrote:
> +struct mp_eosd_image *eosd_image_first(struct mp_eosd_image_list *images)
> +{
> +    images->source = images->first_source;
> +    images->image = NULL;
> +    while (images->source) {
> +        images->image = images->source->images;
> +        if (images->image)
> +            break;
> +        images->source = images->source->priv_next;
> +    }
> +    return images->image;
> +}
> +
> +struct mp_eosd_image *eosd_image_next(struct mp_eosd_image_list *images)
> +{
> +    images->image = images->image->next;
> +    if (!images->image) {
> +        do {
> +            images->source = images->source->priv_next;
> +        } while (images->source && !images->source->images);
> +        if (images->source)
> +            images->image = images->source->images;
> +    }

This loop and the one in eosd_image_first do the same thing
and so should use the same code.
I'd also suggest writing eosd_image_first as

images->source = images->first_source;
images->image  = images->source->images;
while (!images->image) {
    images->source = images->source->priv_next;
    if (!images->source)
        return NULL;
    images->image  = images->source->images;
}


More information about the MPlayer-dev-eng mailing list