summaryrefslogtreecommitdiff
path: root/kernel/log.cc
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2014-08-23 13:54:21 +0200
committerClifford Wolf <clifford@clifford.at>2014-08-23 13:54:21 +0200
commit5dce303a2a2c27d50e99856b6f33467798e13020 (patch)
tree4f32f6e720ef5bb063e48c9d5ab6bd8356c6b3d6 /kernel/log.cc
parentfff12c719fc2d61e36e85f27080a4043078b0929 (diff)
Changed backend-api from FILE to std::ostream
Diffstat (limited to 'kernel/log.cc')
-rw-r--r--kernel/log.cc25
1 files changed, 6 insertions, 19 deletions
diff --git a/kernel/log.cc b/kernel/log.cc
index b742a549..2b4b5db5 100644
--- a/kernel/log.cc
+++ b/kernel/log.cc
@@ -210,20 +210,14 @@ void log_dump_val_worker(RTLIL::SigSpec v) {
const char *log_signal(const RTLIL::SigSpec &sig, bool autoint)
{
- char *ptr;
- size_t size;
-
- FILE *f = open_memstream(&ptr, &size);
- ILANG_BACKEND::dump_sigspec(f, sig, autoint);
- fputc(0, f);
- fclose(f);
+ std::stringstream buf;
+ ILANG_BACKEND::dump_sigspec(buf, sig, autoint);
if (string_buf_size < 100)
string_buf_size++;
else
string_buf.pop_front();
- string_buf.push_back(ptr);
- free(ptr);
+ string_buf.push_back(buf.str());
return string_buf.back().c_str();
}
@@ -239,16 +233,9 @@ const char *log_id(RTLIL::IdString str)
void log_cell(RTLIL::Cell *cell, std::string indent)
{
- char *ptr;
- size_t size;
-
- FILE *f = open_memstream(&ptr, &size);
- ILANG_BACKEND::dump_cell(f, indent, cell);
- fputc(0, f);
- fclose(f);
-
- log("%s", ptr);
- free(ptr);
+ std::stringstream buf;
+ ILANG_BACKEND::dump_cell(buf, indent, cell);
+ log("%s", buf.str().c_str());
}
// ---------------------------------------------------