No limit for length of lines in BLIF front-end
authorClifford Wolf <clifford@clifford.at>
Wed, 19 Oct 2016 10:44:58 +0000 (12:44 +0200)
committerClifford Wolf <clifford@clifford.at>
Wed, 19 Oct 2016 10:44:58 +0000 (12:44 +0200)
frontends/blif/blifparse.cc

index f154f7c048bd6a7722d94bff2022a5c6427e1c13..6d4d608704fa3e3e5edd0ea5fbd7d483e4437a11 100644 (file)
@@ -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;
        }