]> granicus.if.org Git - procps-ng/commit
library: tweak 'other' user/group names for efficiency
authorJim Warner <james.warner@comcast.net>
Tue, 2 Feb 2021 06:00:00 +0000 (00:00 -0600)
committerCraig Small <csmall@dropbear.xyz>
Tue, 9 Feb 2021 05:40:52 +0000 (16:40 +1100)
commit3c87c46439a4cea112b7fc3983b2dab969a0b42a
tree647dbf9a7fb35d3a25ffc2ee41fa8e7b4565f992
parent4770195b870e22ab5a1ce6eece59d32bb90244ba
library: tweak 'other' user/group names for efficiency

This commit just ensures that the relatively expensive
ID to name conversions aren't performed unless they're
explicitly requested. It also internalizes those flags
that required the PROC_FILLSTATUS flag to also be set.

[ requiring a caller, in our case pids.c, to provide ]
[ two flags when a single field was the objective is ]
[ wrong & represents a future potential toe-stubber. ]

[ moreover, what's worse is that those two flags are ]
[ seemingly unrelated. but, without both, a SEGV can ]
[ can be expected when a result.str pointer is NULL. ]

[ by contrast, in the master branch those fields are ]
[ arrays which, when set to zeroes, produce an empty ]
[ string. So, there is no abend (but no name either) ]
[ when one of those two required flags were omitted. ]

[ and worth noting, in that branch it's not just one ]
[ caller required to observe a two flag requirement. ]

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