mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-17 22:02:30 +02:00
eeshow/file.c (file_read): use getline instead of fgets
OSHW-SCHEM-PCB10mm of github.com:cpavlina/kicad-schlib/library/symbol.lib has a line > 1000 characters.
This commit is contained in:
parent
8a087797b2
commit
37351bf8bc
@ -220,12 +220,13 @@ bool file_read(struct file *file,
|
|||||||
bool (*parse)(const struct file *file, void *user, const char *line),
|
bool (*parse)(const struct file *file, void *user, const char *line),
|
||||||
void *user)
|
void *user)
|
||||||
{
|
{
|
||||||
char buf[1000];
|
static char *buf = NULL;
|
||||||
|
static size_t n = 0;
|
||||||
char *nl;
|
char *nl;
|
||||||
|
|
||||||
if (file->vcs)
|
if (file->vcs)
|
||||||
return vcs_read(file->vcs, file, parse, user);
|
return vcs_read(file->vcs, file, parse, user);
|
||||||
while (fgets(buf, sizeof(buf), file->file)) {
|
while (getline(&buf, &n, file->file) > 0) {
|
||||||
nl = strchr(buf, '\n');
|
nl = strchr(buf, '\n');
|
||||||
if (nl)
|
if (nl)
|
||||||
*nl = 0;
|
*nl = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user