| 504 | If PRETEND_BINARY is nonzero, pretend they are binary regardless. */ |
| 505 | |
| 506 | bool GnuDiff::read_files(file_data filevec[], bool /*pretend_binary*/) |
| 507 | { |
| 508 | GNULineRef i; |
| 509 | |
| 510 | find_identical_ends(filevec); |
| 511 | |
| 512 | equivs_alloc = filevec[0].alloc_lines + filevec[1].alloc_lines + 1; |
| 513 | if((GNULineRef)(GNULINEREF_MAX / sizeof(*equivs)) <= equivs_alloc) |
| 514 | xalloc_die(); |
| 515 | equivs = (equivclass *)xmalloc(equivs_alloc * sizeof(*equivs)); |
| 516 | /* Equivalence class 0 is permanently safe for lines that were not |
| 517 | hashed. Real equivalence classes start at 1. */ |
| 518 | equivs_index = 1; |
| 519 | |
| 520 | /* Allocate (one plus) a prime number of hash buckets. Use a prime |
| 521 | number between 1/3 and 2/3 of the value of equiv_allocs, |
| 522 | approximately. */ |
| 523 | for(i = 9; ((GNULineRef)1 << i) < equivs_alloc / 3; ++i) |
| 524 | continue; |
| 525 | nbuckets = ((GNULineRef)1 << i) - prime_offset[i]; |
| 526 | if(GNULINEREF_MAX / sizeof(*buckets) <= nbuckets) |
| 527 | xalloc_die(); |
| 528 | buckets = (GNULineRef *)zalloc((nbuckets + 1) * sizeof(*buckets)); |
| 529 | buckets++; |
| 530 | |
| 531 | for(i = 0; i < 2; ++i) |
| 532 | find_and_hash_each_line(&filevec[i]); |
| 533 | |
| 534 | filevec[0].equiv_max = filevec[1].equiv_max = equivs_index; |
| 535 | |
| 536 | free(equivs); |
| 537 | free(buckets - 1); |
| 538 | |
| 539 | return false; |
| 540 | } |
nothing calls this directly
no outgoing calls
no test coverage detected