[2/2] checkasm: h264dsp: Move the x and y variables into the randomize_buffer macro

Message ID 1467055981-75658-2-git-send-email-martin@martin.st
State Committed
Commit e48746deec48e9ff195841bc3266b4e153a878cd
Headers show

Commit Message

Martin Storsjö June 27, 2016, 7:33 p.m.
This avoids the risk of accidentally clobbering such variables outside
of the macro if the same variables are used there.
---
 tests/checkasm/h264dsp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Luca Barbato June 27, 2016, 9:34 p.m. | #1
On 27/06/16 21:33, Martin Storsjö wrote:
> This avoids the risk of accidentally clobbering such variables outside
> of the macro if the same variables are used there.
> ---
>  tests/checkasm/h264dsp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Set OK.
Diego Biurrun June 27, 2016, 10:40 p.m. | #2
On Mon, Jun 27, 2016 at 10:33:01PM +0300, Martin Storsjö wrote:
> This avoids the risk of accidentally clobbering such variables outside
> of the macro if the same variables are used there.
> ---
>  tests/checkasm/h264dsp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

OK

Diego

Patch

diff --git a/tests/checkasm/h264dsp.c b/tests/checkasm/h264dsp.c
index c3065d2..c9ddd52 100644
--- a/tests/checkasm/h264dsp.c
+++ b/tests/checkasm/h264dsp.c
@@ -34,6 +34,7 @@  static const uint32_t pixel_mask[3] = { 0xffffffff, 0x01ff01ff, 0x03ff03ff };
 
 #define randomize_buffers()                                                  \
     do {                                                                     \
+        int x, y;                                                            \
         uint32_t mask = pixel_mask[bit_depth - 8];                           \
         for (y = 0; y < sz; y++) {                                           \
             for (x = 0; x < PIXEL_STRIDE; x += 4) {                          \
@@ -178,8 +179,7 @@  static void check_idct(void)
     LOCAL_ALIGNED_16(int16_t, subcoef0, [8 * 8 * 2]);
     LOCAL_ALIGNED_16(int16_t, subcoef1, [8 * 8 * 2]);
     H264DSPContext h;
-    int bit_depth, sz, align;
-    int x, y, dc;
+    int bit_depth, sz, align, dc;
     declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *dst, int16_t *block, int stride);
 
     for (bit_depth = 8; bit_depth <= 10; bit_depth++) {