]> granicus.if.org Git - procps-ng/commit
library: tweak the memory allocation logic, <pids> api
authorJim Warner <james.warner@comcast.net>
Wed, 30 Sep 2020 05:00:00 +0000 (00:00 -0500)
committerCraig Small <csmall@dropbear.xyz>
Sun, 11 Oct 2020 06:53:22 +0000 (17:53 +1100)
commite2b0f8b0af7918c4a5872781bc4b8c6ade03ff56
tree82fde0a1a5f517e190bf8b5abb682b3fab6b922d
parent955aaaf732be066cc00a2d0b956a082a08a13518
library: tweak the memory allocation logic, <pids> api

This patch separates the memory allocations into those
used initially from those used in later reallocations.
Thus, we can reduce that iterative realloc() overhead.

Additionally, we'll correct a long standing oops where
multiple history_info structures were created at 'new'
time when only one should have been allocated (jeeze).

[ originally the allocation was strangely based upon ]
[ number of 'items' (???) & later a #define constant ]

Reference(s):
. May, 2016 - subsequent bad history_info logic
commit 9ebadc1438a6665a98a9f0782523b0f9a2a6248f
. Aug, 2015 - original faulty history_info code
commit 7e6a371d8a36b250a2edddff9f5d059640b8132e

Signed-off-by: Jim Warner <james.warner@comcast.net>
proc/pids.c