mirror of
https://github.com/postgres/postgres.git
synced 2025-06-25 01:02:05 +03:00
Rethink API for pg_get_line.c, one more time.
Further experience says that the appending behavior offered by pg_get_line_append is useful to only a very small minority of callers. For most, the requirement to reset the buffer after each line is just an error-prone nuisance. Hence, invent another alternative call pg_get_line_buf, which takes care of that detail. Noted while reviewing a patch from Daniel Gustafsson. Discussion: https://postgr.es/m/48A4FA71-524E-41B9-953A-FD04EF36E2E7@yesql.se
This commit is contained in:
@ -49,7 +49,7 @@ ecpg_filter(const char *sourcefile, const char *outfile)
|
||||
|
||||
initStringInfo(&linebuf);
|
||||
|
||||
while (pg_get_line_append(s, &linebuf))
|
||||
while (pg_get_line_buf(s, &linebuf))
|
||||
{
|
||||
/* check for "#line " in the beginning */
|
||||
if (strstr(linebuf.data, "#line ") == linebuf.data)
|
||||
@ -69,7 +69,6 @@ ecpg_filter(const char *sourcefile, const char *outfile)
|
||||
}
|
||||
}
|
||||
fputs(linebuf.data, t);
|
||||
resetStringInfo(&linebuf);
|
||||
}
|
||||
|
||||
pfree(linebuf.data);
|
||||
|
Reference in New Issue
Block a user