compiler: remove unnecessary zero check on Length before zero'ing it
Colin King
PATCH 1/1 compiler: remove unnecessary zero check on Length before zero'ing it
From: Colin Ian King <colin.king(a)canonical.com>
Length is being checked to see if the contents is non-zero before setting it to zero. It would be simpler to just set this to zero without doing the non-zero check as it saves a load and a jmp (~14 bytes in x86 object code). This also fixes a static analysis warning in DtCompileIort:
CID 1298707 (#1 of 1): Uninitialized scalar variable (UNINIT).
uninit_use_in_call: Using uninitialized value PaddingLength when calling DtCompileGeneric.
..since the length is not being intitialized in this code before calling DtCompileGeneric.
--- source/compiler/dttable2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
source/compiler/dttable2.c +1 -1
@@ -1707,7 +1707,7 @@ DtCompileGeneric (/* Now we can actually compile the parse tree */ -if (Length && *Length) +if (Length) { *Length =0 ; }
Signature · 1 line
2.7.0.rc3
Zheng
Acked-by Lv Zheng on v1 1/1Hi,
Quoted 12 lines
From: Devel [mailto:devel-bounces(a)acpica.org] On Behalf Of Colin King
Subject: [Devel] [PATCH] compiler: remove unnecessary zero check on Length before zero'ing itFrom: Colin Ian King <colin.king(a)canonical.com>
Length is being checked to see if the contents is non-zero before setting it to zero. It would be simpler to just set this to zero without doing the non-zero check as it saves a load and a jmp (~14 bytes in x86 object code). This also fixes a static analysis warning in DtCompileIort:
Quoted 8 lines
CID 1298707 (#1 of 1): Uninitialized scalar variable (UNINIT).
uninit_use_in_call: Using uninitialized value PaddingLength when calling DtCompileGeneric...since the length is not being intitialized in this code before calling DtCompileGeneric.
Signed-off-by Colin Ian King <colin.king(a)canonical.com>
Thanks
-Lv
Quoted 24 lines
--- source/compiler/dttable2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)source/compiler/dttable2.c +1
-2@@ -1707,7 +1707,7 @@ DtCompileGeneric (/* Now we can actually compile the parse tree */ -if (Length && *Length) +if (Length) { *Length =0 ; } --2.7.0.rc3
_______________________________________________
Devel mailing list
Devel(a)acpica.org
https://lists.acpica.org/mailman/listinfo/devel