[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [trunnel/master] Stop emitting needless loops over fixed arrays of uint8_t
commit e4be3b4e1acd223f63add4b02d0072852cd620e7
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Fri Sep 26 08:59:05 2014 -0400
Stop emitting needless loops over fixed arrays of uint8_t
Coverity says this code is stupid:
for (idx = 0; idx < 32; ++idx)
obj->hmac[idx] = (obj->hmac[idx]);
And it's right! So let's stop generating it.
Should fix Tor CID 1241499
---
lib/trunnel/CodeGen.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/trunnel/CodeGen.py b/lib/trunnel/CodeGen.py
index 9d91394..392783b 100644
--- a/lib/trunnel/CodeGen.py
+++ b/lib/trunnel/CodeGen.py
@@ -2468,7 +2468,7 @@ class ParseFnGenerator(CodeGenerator):
memcpy(obj->{c_name}, ptr, {multiplier}{width});
""", c_name=sfa.c_name, multiplier=multiplier,
width=sfa.width, truncated=self.truncatedLabel)
- if type(sfa.basetype) == trunnel.Grammar.IntType:
+ if type(sfa.basetype) == trunnel.Grammar.IntType and sfa.basetype.width > 8:
self.format("""
{{
unsigned idx;
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits