[fc-lang] Continue parsing after an "include" (#20179)

This commit is contained in:
Behdad Esfahbod 2009-03-02 13:25:37 +03:30
parent abe0e056d5
commit f6993c8803
1 changed files with 18 additions and 11 deletions

View File

@ -138,18 +138,25 @@ scan (FILE *f, char *file, FcCharSetFreezer *freezer)
{ {
if (!strncmp (line, "include", 7)) if (!strncmp (line, "include", 7))
{ {
file = strchr (line, ' '); FILE *included_f;
if (!file) char *included_file;
fatal (line, lineno, included_file = strchr (line, ' ');
if (!included_file)
fatal (file, lineno,
"invalid syntax, expected: include filename"); "invalid syntax, expected: include filename");
while (isspace(*file)) while (isspace(*included_file))
file++; included_file++;
f = scanopen (file); included_f = scanopen (included_file);
if (!f) if (!included_f)
fatal (file, 0, "can't open"); fatal (included_file, 0, "can't open");
n = scan (f, file, freezer); n = scan (included_f, included_file, freezer);
fclose (f); fclose (included_f);
return n; if (!c)
c = FcCharSetCreate ();
if (!FcCharSetMerge (c, n, NULL))
fatal (file, lineno, "out of memory");
FcCharSetDestroy (n);
continue;
} }
if (strchr (line, '-')) if (strchr (line, '-'))
{ {