mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-26 11:18:55 -06:00
bugfix in pgf_tabular_linearize
This commit is contained in:
@@ -2206,21 +2206,25 @@ PgfText **pgf_tabular_linearize(PgfDB *db, PgfConcrRevision revision,
|
|||||||
linearizer.reverse_and_label(false);
|
linearizer.reverse_and_label(false);
|
||||||
if (linearizer.resolve()) {
|
if (linearizer.resolve()) {
|
||||||
ref<PgfConcrLincat> lincat = linearizer.get_lincat();
|
ref<PgfConcrLincat> lincat = linearizer.get_lincat();
|
||||||
PgfText **res = (PgfText **)
|
if (lincat != 0) {
|
||||||
malloc((lincat->fields->len+1)*2*sizeof(PgfText*));
|
PgfText **res = (PgfText **)
|
||||||
size_t pos = 0;
|
malloc((lincat->fields->len+1)*2*sizeof(PgfText*));
|
||||||
for (size_t i = 0; i < lincat->fields->len; i++) {
|
if (res == NULL)
|
||||||
linearizer.linearize(&out, i);
|
throw pgf_systemerror(ENOMEM);
|
||||||
|
size_t pos = 0;
|
||||||
|
for (size_t i = 0; i < lincat->fields->len; i++) {
|
||||||
|
linearizer.linearize(&out, i);
|
||||||
|
|
||||||
PgfText *text = out.get_text();
|
PgfText *text = out.get_text();
|
||||||
if (text != NULL) {
|
if (text != NULL) {
|
||||||
res[pos++] = textdup(&(*lincat->fields->data[i]));
|
res[pos++] = textdup(&(*lincat->fields->data[i]));
|
||||||
res[pos++] = text;
|
res[pos++] = text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
res[pos++] = NULL;
|
||||||
|
res[pos++] = NULL;
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
res[pos++] = NULL;
|
|
||||||
res[pos++] = NULL;
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
} PGF_API_END
|
} PGF_API_END
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user