No limit for length of lines in BLIF front-end

This commit is contained in:
Clifford Wolf 2016-10-19 12:44:58 +02:00
parent 0b3885bbfd
commit 042b67f024
1 changed files with 7 additions and 1 deletions

View 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) static bool read_next_line(char *&buffer, size_t &buffer_size, int &line_count, std::istream &f)
{ {
string strbuf;
int buffer_len = 0; int buffer_len = 0;
buffer[0] = 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] == '\\') if (buffer_len > 0 && buffer[buffer_len-1] == '\\')
buffer[--buffer_len] = 0; buffer[--buffer_len] = 0;
line_count++; line_count++;
if (!f.getline(buffer+buffer_len, buffer_size-buffer_len)) if (!std::getline(f, strbuf))
return false; 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 } else
return true; return true;
} }