Merge pull request #24 from jlferrer/fix_compiler_big_files

This commit is contained in:
David Lamparter 2023-04-23 14:12:52 +02:00 committed by GitHub
commit c79b3afbbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1340,14 +1340,22 @@ int main() {
struct node *all_files = NULL, *all_structs = NULL; struct node *all_files = NULL, *all_structs = NULL;
struct id_bst *used_import_ids = NULL; struct id_bst *used_import_ids = NULL;
int i, j; int i, j;
uint64_t total_len=0;
struct capn_segment *current_seg;
if (capn_init_fp(&capn, stdin, 0)) { if (capn_init_fp(&capn, stdin, 0)==-1) {
fprintf(stderr, "failed to read schema from stdin\n"); fprintf(stderr, "failed to read schema from stdin\n");
return -1; return -1;
} }
g_valseg.data = calloc(1, capn.seglist->len); current_seg = capn.seglist;
g_valseg.cap = capn.seglist->len; do{
total_len+=current_seg->len;
current_seg = current_seg->next;
}while(current_seg);
g_valseg.data = calloc(1, total_len);
g_valseg.cap = total_len;
root.p = capn_getp(capn_root(&capn), 0, 1); root.p = capn_getp(capn_root(&capn), 0, 1);
read_CodeGeneratorRequest(&req, root); read_CodeGeneratorRequest(&req, root);