[FFmpeg-devel] MPEG-PS demuxer index memory usage

Trent Piepho xyzzy
Sat Jan 5 01:46:02 CET 2008


On Fri, 4 Jan 2008, [iso-8859-1] M?ns Rullg?rd wrote:
> > -            memmove(entries + index + 1, entries + index, sizeof(AVIndexEntry)*(st->nb_index_entries - index));
> > +            memmove(&entries[index + 1], &entries[index], sizeof(AVIndexEntry)*(st->nb_index_entries - index));
>
> Those two lines are exactly equivalent.  In C, the construct a[b] can
> always be replaced by ((a) + (b)) and conversely.  This means that the

You mean "*((a) +(b))" replaces "a[b]", or "&a[b]" replaces "((a)+(b))", of
course.

> first argument to the above memmove() call could be written
> &index[entries]+1, or even &1[entries]+index, should one feel thusly
> inclined.

I don't think &1[entries]+index would work.  1[entries] is dereferencing an
integer, which should be an error, but might be just a warning under some
compiler/options/c standard combinations.  Maybe you meant
"&entries[1]+index", which would work.




More information about the ffmpeg-devel mailing list