[FFmpeg-devel] [PATCH] QT RLE header parser refactoring

Michael Niedermayer michaelni
Mon Mar 10 13:04:19 CET 2008


On Sun, Mar 09, 2008 at 09:19:27PM -0700, Mike Melanson wrote:
> Hi,
>
> I was reviewing old correspondence regarding the QT RLE decoder. Michael 
> indicated that rampant code duplication should be eliminated. This patch  
> is a first attempt at that. Each of the individual decoder functions has 
> the same code copied. I separated it out into a macro. This was the easiest 
> solution since the code touches on a lot of variables declared in the local 
> scope.
>
> Critiques? Thanks...

Iam strongly against such macros, i dont belive that there is no clean way to
factorize the code. Macros are forced code duplication, that is the code
cannot be compiled to an object file without the duplication. Also having
variable declaration and use split between macros reduces readability very
significantly, and the only change this does is to the source, the object
files as already said still always contain the duplication.
Also the lines before as well as after the macro are also 1:1
identical and thus should be in that macro.

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080310/385d4121/attachment.pgp>



More information about the ffmpeg-devel mailing list