On 05/07/2020 22:55, Jan Kiszka wrote:
On 30.06.20 08:42, Andrej Utz wrote:
Improves its handling in the code and slightly increases the overall
performance as well.
Signed-off-by: Andrej Utz <andrej....@st.oth-regensburg.de>
---
pyjailhouse/config_parser.py | 51 ++++++++++++++----------------------
1 file changed, 20 insertions(+), 31 deletions(-)
diff --git a/pyjailhouse/config_parser.py b/pyjailhouse/config_parser.py
index 6b9d9066..b75b9312 100644
--- a/pyjailhouse/config_parser.py
+++ b/pyjailhouse/config_parser.py
@@ -52,15 +52,13 @@ class JAILHOUSE_MEM(ExtendedEnum, int):
class MemRegion:
- _REGION_FORMAT = 'QQQQ'
- SIZE = struct.calcsize(_REGION_FORMAT)
+ _BIN_FMT = struct.Struct('QQQQ')
def __init__(self, region_struct):
(self.phys_start,
self.virt_start,
self.size,
- self.flags) = \
- struct.unpack_from(MemRegion._REGION_FORMAT, region_struct)
+ self.flags) = self._BIN_FMT.unpack_from(region_struct)
Let's clarify that _BIN_FMT is a class var by accessing it via the class
name (MemRegion._BIN_FMT). Same for the rest.
While I'm not a fan of redundant naming for references, I can how would
improve code clarity. Will change.
Andrej
Jan
--
You received this message because you are subscribed to the Google Groups
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to jailhouse-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/jailhouse-dev/85d2aa12-22c1-5445-1d26-e55fe3c9dc4e%40st.oth-regensburg.de.