[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [trunnel/master] It is not necessary to compare "result" to 0 in relay_fail



commit caeb549da47e44532a22dcb5baffaf82856db24e
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Thu May 28 12:38:47 2015 -0400

    It is not necessary to compare "result" to 0 in relay_fail
    
    Instead, assert that it is less than 0.
    
    Otherwise, Coverity issues frequent complaints about dead code.
---
 lib/trunnel/CodeGen.py  |    2 +-
 lib/trunnel/__init__.py |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/trunnel/CodeGen.py b/lib/trunnel/CodeGen.py
index 5a5f070..047a078 100644
--- a/lib/trunnel/CodeGen.py
+++ b/lib/trunnel/CodeGen.py
@@ -2409,7 +2409,7 @@ class ParseFnGenerator(CodeGenerator):
             self.w(' truncated:\n  return -2;\n')
         if 'relay_fail' in self.needLabels:
             self.w(
-                ' relay_fail:\n  if (result >= 0) result = -1;\n  return result;\n')
+                ' relay_fail:\n  trunnel_assert(result < 0);\n  return result;\n')
         if 'trunnel_alloc_failed' in self.needLabels:
             self.w(" trunnel_alloc_failed:\n  return -1;\n")
         if 'fail' in self.needLabels:
diff --git a/lib/trunnel/__init__.py b/lib/trunnel/__init__.py
index b39d47a..e444887 100644
--- a/lib/trunnel/__init__.py
+++ b/lib/trunnel/__init__.py
@@ -3,4 +3,4 @@
 # a package.
 #
 
-__version__ = "1.4-pre"
+__version__ = "1.4.1"

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits