[MPlayer-dev-eng] [PATCH] simplify/refactor code to grow array in demux_mkv.c

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Tue Oct 10 17:06:31 CEST 2006


Hello,
On Tue, Oct 10, 2006 at 12:29:48AM +0200, Aurelien Jacobs wrote:
> On Mon, 9 Oct 2006 22:21:50 +0200
> Reimar Döffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de> wrote:
[...]
> > Since realloc works fine with NULL, the old way was unnecessarily
> > complicated I think.
> 
> Agree.

So applied.

> > @@ -1549,12 +1549,7 @@
> >  
> >                mp_msg (MSGT_DEMUX, MSGL_V, "[mkv] | + an attachment...\n");
> >  
> > -              if (mkv_d->attachments == NULL)
> > -                mkv_d->attachments = malloc (32*sizeof(*mkv_d->attachments));
> > -              else if (!(mkv_d->num_attachments % 32))
> > -                mkv_d->attachments = realloc (mkv_d->attachments,
> > -                                           (mkv_d->num_attachments + 32)
> > -                                           * sizeof(*mkv_d->attachments));
> > +              grow_array(&mkv_d->attachments, mkv_d->num_attachments, sizeof(*mkv_d->attachments));
> >  
> >                while (len > 0)
> >                  {
> 
> Maybe try to keep line size <80 characters if possible ?

I usually prefer to keep it in one line if it's only slightly more than
80 characters, but I don't mind much so changed.

Greetings,
Reimar Döffinger



More information about the MPlayer-dev-eng mailing list