aboutsummaryrefslogtreecommitdiffstats
path: root/frontends/blif
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2016-10-19 12:44:58 +0200
committerClifford Wolf <clifford@clifford.at>2016-10-19 12:44:58 +0200
commit042b67f02472754a6a9d50a2cb5fe71a85ffb3b4 (patch)
tree8364cd6c60674e0b5414d2ee08fdf9699aea5d86 /frontends/blif
parent0b3885bbfd52186d220fba33ffd12446cdd7abd1 (diff)
downloadyosys-042b67f02472754a6a9d50a2cb5fe71a85ffb3b4.tar.gz
yosys-042b67f02472754a6a9d50a2cb5fe71a85ffb3b4.tar.bz2
yosys-042b67f02472754a6a9d50a2cb5fe71a85ffb3b4.zip
No limit for length of lines in BLIF front-end
Diffstat (limited to 'frontends/blif')
-rw-r--r--frontends/blif/blifparse.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/frontends/blif/blifparse.cc b/frontends/blif/blifparse.cc
index f154f7c04..6d4d60870 100644
--- a/frontends/blif/blifparse.cc
+++ b/frontends/blif/blifparse.cc
@@ -23,6 +23,7 @@ YOSYS_NAMESPACE_BEGIN
static bool read_next_line(char *&buffer, size_t &buffer_size, int &line_count, std::istream &f)
{
+ string strbuf;
int buffer_len = 0;
buffer[0] = 0;
@@ -42,8 +43,13 @@ static bool read_next_line(char *&buffer, size_t &buffer_size, int &line_count,
if (buffer_len > 0 && buffer[buffer_len-1] == '\\')
buffer[--buffer_len] = 0;
line_count++;
- if (!f.getline(buffer+buffer_len, buffer_size-buffer_len))
+ if (!std::getline(f, strbuf))
return false;
+ while (buffer_size-buffer_len < strbuf.size()+1) {
+ buffer_size *= 2;
+ buffer = (char*)realloc(buffer, buffer_size);
+ }
+ strcpy(buffer+buffer_len, strbuf.c_str());
} else
return true;
}