Since there's no namespace feature in C, namespace img has been replaced
with adding the prefix "img" to the namespace members.
Prefix "img" has been added to the function names of functions that used
to be wrapped in namespace img. Those are img::format() functions.
I.e. replaced img::format with the img_format.
Typedef address that used to belong to namespace img now is called
img_address.
Signed-off-by: Milica Lazarevic <milica.lazarevic@syrmia.com>
---
disas/nanomips.cpp | 1433 ++++++++++++++++++++++----------------------
disas/nanomips.h | 10 +-
2 files changed, 713 insertions(+), 730 deletions(-)
diff --git a/disas/nanomips.cpp b/disas/nanomips.cpp
index 9be8df75dd..96b7bfd83b 100644
--- a/disas/nanomips.cpp
+++ b/disas/nanomips.cpp
@@ -137,131 +137,118 @@ int print_insn_nanomips(bfd_vma memaddr, struct
disassemble_info *info)
}
-namespace img
+std::string img_format(const char *format, ...)
{
- address addr32(address a)
- {
- return a;
+ char buffer[256];
+ va_list args;
+ va_start(args, format);
+ int err = vsprintf(buffer, format, args);
+ if (err < 0) {
+ perror(buffer);
}
+ va_end(args);
+ return buffer;
+}
- std::string format(const char *format, ...)
- {
- char buffer[256];
- va_list args;
- va_start(args, format);
- int err = vsprintf(buffer, format, args);
- if (err < 0) {
- perror(buffer);
- }
- va_end(args);
- return buffer;
- }
-
- std::string format(const char *format,
- std::string s)
- {
- char buffer[256];
-
- sprintf(buffer, format, s.c_str());
+std::string img_format(const char *format,
+ std::string s)
+{
+ char buffer[256];
- return buffer;
- }
+ sprintf(buffer, format, s.c_str());
- std::string format(const char *format,
- std::string s1,
- std::string s2)
- {
- char buffer[256];
+ return buffer;
+}
- sprintf(buffer, format, s1.c_str(), s2.c_str());
+std::string img_format(const char *format,
+ std::string s1,
+ std::string s2)
+{
+ char buffer[256];
- return buffer;
- }
+ sprintf(buffer, format, s1.c_str(), s2.c_str());
- std::string format(const char *format,
- std::string s1,
- std::string s2,
- std::string s3)
- {
- char buffer[256];
+ return buffer;
+}
- sprintf(buffer, format, s1.c_str(), s2.c_str(), s3.c_str());
+std::string img_format(const char *format,
+ std::string s1,
+ std::string s2,
+ std::string s3)
+{
+ char buffer[256];
- return buffer;
- }
+ sprintf(buffer, format, s1.c_str(), s2.c_str(), s3.c_str());
- std::string format(const char *format,
- std::string s1,
- std::string s2,
- std::string s3,
- std::string s4)
- {
- char buffer[256];
+ return buffer;
+}
- sprintf(buffer, format, s1.c_str(), s2.c_str(), s3.c_str(),
- s4.c_str());
+std::string img_format(const char *format,
+ std::string s1,
+ std::string s2,
+ std::string s3,
+ std::string s4)
+{
+ char buffer[256];
- return buffer;
- }
+ sprintf(buffer, format, s1.c_str(), s2.c_str(), s3.c_str(),
+ s4.c_str());
- std::string format(const char *format,
- std::string s1,
- std::string s2,
- std::string s3,
- std::string s4,
- std::string s5)
- {
- char buffer[256];
+ return buffer;
+}
- sprintf(buffer, format, s1.c_str(), s2.c_str(), s3.c_str(),
- s4.c_str(), s5.c_str());
+std::string img_format(const char *format,
+ std::string s1,
+ std::string s2,
+ std::string s3,
+ std::string s4,
+ std::string s5)
+{
+ char buffer[256];
- return buffer;
- }
+ sprintf(buffer, format, s1.c_str(), s2.c_str(), s3.c_str(),
+ s4.c_str(), s5.c_str());
- std::string format(const char *format,
- uint64 d,
- std::string s2)
- {
- char buffer[256];
+ return buffer;
+}
- sprintf(buffer, format, d, s2.c_str());
+std::string img_format(const char *format,
+ uint64 d,
+ std::string s2)
+{
+ char buffer[256];
- return buffer;
- }
+ sprintf(buffer, format, d, s2.c_str());
- std::string format(const char *format,
- std::string s1,
- uint64 d,
- std::string s2)
- {
- char buffer[256];
+ return buffer;
+}
- sprintf(buffer, format, s1.c_str(), d, s2.c_str());
+std::string img_format(const char *format,
+ std::string s1,
+ uint64 d,
+ std::string s2)
+{
+ char buffer[256];
- return buffer;
- }
+ sprintf(buffer, format, s1.c_str(), d, s2.c_str());
- std::string format(const char *format,
- std::string s1,
- std::string s2,
- uint64 d)
- {
- char buffer[256];
+ return buffer;
+}
- sprintf(buffer, format, s1.c_str(), s2.c_str(), d);
+std::string img_format(const char *format,
+ std::string s1,
+ std::string s2,
+ uint64 d)
+{
+ char buffer[256];
- return buffer;
- }
+ sprintf(buffer, format, s1.c_str(), s2.c_str(), d);
- char as_char(int c)
- {
- return static_cast<char>(c);
- }
-};