ptx: prefer xpalloc to x2nrealloc
commit1932ca94d391b59a9116367425d7bad62f80c484
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 7 Nov 2024 22:09:26 +0000 (7 14:09 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 9 Nov 2024 07:41:18 +0000 (8 23:41 -0800)
tree02db8db56d38802ba594cb2c907da2a869ea093d
parenta824f50d96e4a9f5ee7f4ec3f04339015926f6e2
ptx: prefer xpalloc to x2nrealloc

* src/ptx.c (line_width, gap_size, WORD, WORD_TABLE)
(maximum_word_length, reference_max_width, occurs_alloc)
(number_of_occurs, half_line_width, truncation_string_length)
(compare_words, search_table, digest_word_file)
(find_occurs_in_text, fix_output_parameters)
(generate_all_output, main, find_occurs_in_text)
(fix_output_parameters, generate_all_output):
Prefer idx_t to ptrdiff_t/size_t for nonnegative sizes.
(first, second): Remove macros, replacing them with locals.
(search_table): Use hi (for highest + 1) to simplify.
Avoid unlikely overflow by not computing lo + hi.
(digest_word_file, find_occurs_in_text): Use xpalloc, not x2nrealloc.
src/ptx.c