1
0
forked from GitHub/gf-core

make sure that pgf_concrete_load has no effect on grammars that are completely loaded

This commit is contained in:
kr.angelov
2013-12-17 13:57:16 +00:00
parent d90657f1f1
commit ac835fe3b0

View File

@@ -1234,9 +1234,11 @@ pgf_read_concrete(PgfReader* rdr, PgfAbstr* abstr, bool with_content)
concr->pool = NULL;
if (with_content)
if (with_content) {
pgf_read_concrete_content(rdr, concr);
else {
concr->fin.fn = NULL;
} else {
pgf_read_concrete_init_header(concr);
concr->fin.fn = gu_concr_fini;
@@ -1250,7 +1252,7 @@ pgf_read_concrete(PgfReader* rdr, PgfAbstr* abstr, bool with_content)
void
pgf_concrete_load(PgfConcr* concr, GuIn* in, GuExn* err)
{
if (concr->pool != NULL)
if (concr->fin.fn == NULL || concr->pool != NULL)
return; // already loaded
GuPool* pool = gu_new_pool();
@@ -1286,6 +1288,9 @@ pgf_concrete_load(PgfConcr* concr, GuIn* in, GuExn* err)
void
pgf_concrete_unload(PgfConcr* concr)
{
if (concr->fin.fn == NULL)
return;
gu_concr_fini(&concr->fin);
}