ptserver: move allocation out of put_prentries() into listEntries() 15/13315/3
authorBenjamin Kaduk <kaduk@mit.edu>
Thu, 30 Aug 2018 14:54:23 +0000 (09:54 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Mon, 2 Nov 2020 08:08:38 +0000 (03:08 -0500)
commitc1c4e308cfe0b189778259840f02183c83c1083e
tree44a720d6e39649a91958a8152b726029fbe6af4e
parent61a8f0c5b8b1cf5022e4f20af4eb42cae1cb03f6
ptserver: move allocation out of put_prentries() into listEntries()

put_prentries() is a helper function for listEntries(), but the contract
between the two is rather odd -- put_prentries() is expected to notice
when the backing store has not yet been allocated and silently allocate
it, even though there is only the single caller and the allocation could
be done in the caller.

Move the allocation to the caller and adjust the "buffer is full"
logic accordingly, and normalize the initialization of the output
array to just use calloc() instead of individual memset()s when
populating each entry.

Change-Id: Icf84e3b60eae81a1570b12d7adbf006a24a104f3
Reviewed-on: https://gerrit.openafs.org/13315
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
src/ptserver/ptprocs.c