]> git.ipfire.org Git - thirdparty/coreutils.git/commit
factor,tail: avoid quadratic reallocation
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 23 Sep 2023 08:15:08 +0000 (01:15 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 23 Sep 2023 08:15:50 +0000 (01:15 -0700)
commit769ace51e8a1129c44ee4e7e209c3b2df2111524
treea29bc17997ad8db7ca8ff4ae822afa111f7cb402
parent9ecc4f4e44ef8797d1fcd01574ebb71999744d73
factor,tail: avoid quadratic reallocation

* src/factor.c (struct mp_factors): New member nalloc.
(mp_factor_init): Initialize it.
* src/factor.c (mp_factor_insert):
* src/tail.c (parse_options): Use xpalloc to avoid quadratic
worst-case behavior on reallocation.
* src/tail.c (pids_alloc): New static var.
src/factor.c
src/tail.c