From 480237cdf869face21a43c7ca826daff5754184f Mon Sep 17 00:00:00 2001
From: Kristof Szabados <Kristof.Szabados@ericsson.com>
Date: Thu, 27 Dec 2018 15:23:25 +0100
Subject: [PATCH] its a bit better if the module is able to handle its own
 private internals.

Signed-off-by: Kristof Szabados <Kristof.Szabados@ericsson.com>
---
 core/Module_list.cc | 17 ++++++++++++-----
 core/Module_list.hh |  1 +
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/core/Module_list.cc b/core/Module_list.cc
index d52969013..658176564 100644
--- a/core/Module_list.cc
+++ b/core/Module_list.cc
@@ -425,11 +425,7 @@ void Module_List::push_version(Text_Buf& text_buf)
   text_buf.push_int(n_modules);
   for (TTCN_Module *list_iter = list_head; list_iter != NULL;
     list_iter = list_iter->list_next) {
-    text_buf.push_string(list_iter->module_name);
-    if (list_iter->md5_checksum != NULL) {
-      text_buf.push_int(16);
-      text_buf.push_raw(16, list_iter->md5_checksum);
-    } else text_buf.push_int((RInt)0);
+    list_iter->push_version(text_buf);
   }
 }
 
@@ -1231,6 +1227,17 @@ void TTCN_Module::list_testcases()
       printf("%s.%s\n", module_name, list_iter->testcase_name);
 }
 
+void TTCN_Module::push_version(Text_Buf& text_buf)
+{
+  text_buf.push_string(module_name);
+  if (md5_checksum != NULL) {
+    text_buf.push_int(16);
+    text_buf.push_raw(16, md5_checksum);
+  } else {
+    text_buf.push_int((RInt)0);
+  }
+}
+
 const namespace_t *TTCN_Module::get_ns(size_t p_index) const
 {
   if (p_index == (size_t)-1) return NULL;
diff --git a/core/Module_list.hh b/core/Module_list.hh
index 1a081d2ee..0e04f1e98 100644
--- a/core/Module_list.hh
+++ b/core/Module_list.hh
@@ -232,6 +232,7 @@ public:
   void print_version();
   ModuleVersion* get_version() const;
   void list_testcases();
+  void push_version(Text_Buf& text_buf);
   size_t get_num_ns() const { return num_namespaces; }
   const namespace_t *get_ns(size_t p_index) const;
   const namespace_t *get_controlns() const;
-- 
GitLab