mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +03:00
Applied patch by MauMau <maumau307@gmail.com> to escape filenames in #line statements.
This commit is contained in:
parent
cf183732d2
commit
7d114fb46f
@ -95,9 +95,22 @@ hashline_number(void)
|
|||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
char *line = mm_alloc(strlen("\n#line %d \"%s\"\n") + sizeof(int) * CHAR_BIT * 10 / 3 + strlen(input_filename));
|
/* "* 2" here is for escaping \s below */
|
||||||
|
char *line = mm_alloc(strlen("\n#line %d \"%s\"\n") + sizeof(int) * CHAR_BIT * 10 / 3 + strlen(input_filename) * 2);
|
||||||
|
char *src,
|
||||||
|
*dest;
|
||||||
|
|
||||||
sprintf(line, "\n#line %d \"%s\"\n", yylineno, input_filename);
|
sprintf(line, "\n#line %d \"", yylineno);
|
||||||
|
src = input_filename;
|
||||||
|
dest = line + strlen(line);
|
||||||
|
while (*src)
|
||||||
|
{
|
||||||
|
if (*src == '\\')
|
||||||
|
*dest++ = '\\';
|
||||||
|
*dest++ = *src++;
|
||||||
|
}
|
||||||
|
*dest = '\0';
|
||||||
|
strcat(dest, "\"\n");
|
||||||
|
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user