[FFmpeg-devel] [PATCH] fix unused variable warning in libswscale
Diego Biurrun
diego
Tue Nov 4 09:50:41 CET 2008
On Tue, Nov 04, 2008 at 12:20:30AM +0100, Diego Biurrun wrote:
> Here is a small patch to eliminate an unused variable warning.
Since this simple change, seems to have generated a surprising amount of
questions, here are the two functions side-by-side, with the body of the
for loop omitted.
before:
static inline void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, long width, uint32_t *unused)
{
int i;
assert(src1==src2);
#ifdef HAVE_MMX
RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_RGB24);
#else
for (i=0; i<width; i++) {
}
#endif
}
after:
static inline void RENAME(rgb24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, long width, uint32_t *unused)
{
#ifdef HAVE_MMX
assert(src1==src2);
RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_RGB24);
#else
int i;
assert(src1==src2);
for (i=0; i<width; i++) {
}
#endif
}
Yes, the assert is duplicated, but the alternative is to mix
declarations and statements if the variable declaration is placed below
the assert. In any case the second alternative is more readable IMO
since you have two separate blocks and not intermingled preprocessor
statements.
Diego
More information about the ffmpeg-devel
mailing list