forked from GitHub/gf-core
fix the DB_scope in pgf_read_ngf
This commit is contained in:
@@ -103,20 +103,22 @@ PgfPGF *pgf_read_ngf(const char *fpath, PgfExn* err)
|
|||||||
try {
|
try {
|
||||||
pgf = new PgfPGF(fpath, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
|
pgf = new PgfPGF(fpath, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
|
||||||
|
|
||||||
if (DB::get_root<PgfPGFRoot>() == 0) {
|
{
|
||||||
is_new = true;
|
|
||||||
|
|
||||||
DB_scope scope(pgf, WRITER_SCOPE);
|
DB_scope scope(pgf, WRITER_SCOPE);
|
||||||
|
|
||||||
ref<PgfPGFRoot> root = DB::malloc<PgfPGFRoot>();
|
if (DB::get_root<PgfPGFRoot>() == 0) {
|
||||||
root->major_version = 2;
|
is_new = true;
|
||||||
root->minor_version = 0;
|
ref<PgfPGFRoot> root = DB::malloc<PgfPGFRoot>();
|
||||||
root->gflags = 0;
|
root->major_version = 2;
|
||||||
root->abstract.name = DB::malloc<PgfText>();
|
root->minor_version = 0;
|
||||||
root->abstract.name->size = 0;
|
root->gflags = 0;
|
||||||
root->abstract.aflags = 0;
|
root->abstract.name = DB::malloc<PgfText>();
|
||||||
root->abstract.funs = 0;
|
root->abstract.name->size = 0;
|
||||||
root->abstract.cats = 0;
|
root->abstract.aflags = 0;
|
||||||
|
root->abstract.funs = 0;
|
||||||
|
root->abstract.cats = 0;
|
||||||
|
DB::set_root<PgfPGFRoot>(root);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pgf;
|
return pgf;
|
||||||
|
|||||||
Reference in New Issue
Block a user