Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/5001

Change subject: misc: Rename the (De|En)codeVarint function _(De| En)codeVarint32.
......................................................................

misc: Rename the (De|En)codeVarint function _(De|En)codeVarint32.

DecodeVarint implicitly truncates its inputs to 32 bits, and that should be
obvious from its name, and so not a surprise to the caller. EncodeVarint also
has the suffix added for consistency. Both functions are only used in
protolib.py, so add a _ to make it private (in the python sense) to the
module.

Change-Id: I835295717bb51672351b963fe1227ed619836f22
---
M util/protolib.py
1 file changed, 4 insertions(+), 4 deletions(-)



diff --git a/util/protolib.py b/util/protolib.py
index c8c6d0c..4f3f2c7 100644
--- a/util/protolib.py
+++ b/util/protolib.py
@@ -98,7 +98,7 @@
         exit(-1)
     return proto_in

-def DecodeVarint(in_file):
+def _DecodeVarint32(in_file):
     """
     The decoding of the Varint32 is copied from
     google.protobuf.internal.decoder and is only repeated here to
@@ -134,7 +134,7 @@
     False if no message could be read.
     """
     try:
-        size, pos = DecodeVarint(in_file)
+        size, pos = _DecodeVarint32(in_file)
         if size == 0:
             return False
         buf = in_file.read(size)
@@ -143,7 +143,7 @@
     except IOError:
         return False

-def EncodeVarint(out_file, value):
+def _EncodeVarint32(out_file, value):
   """
   The encoding of the Varint32 is copied from
   google.protobuf.internal.encoder and is only repeated here to
@@ -162,5 +162,5 @@
     Encoded a message with the length prepended as a 32-bit varint.
     """
     out = message.SerializeToString()
-    EncodeVarint(out_file, len(out))
+    _EncodeVarint32(out_file, len(out))
     out_file.write(out)

--
To view, visit https://gem5-review.googlesource.com/5001
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I835295717bb51672351b963fe1227ed619836f22
Gerrit-Change-Number: 5001
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabebl...@google.com>
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to