From: Junio C Hamano Date: Tue, 09 Feb 2021 20:47:32 GMT Subject: Re: [PATCH v2 12/17] chunk-format: create read chunk API Message-ID: In-Reply-To: Derrick Stolee writes: > In future series, additional protections could be added, and > I would expect that to be done by converting callers of > pair_chunk() into callers of read_chunk() with appropriate > callback functions. I am perfectly OK with leaving the interface as-is, as apparently it is sufficient for the current callers. It was just it looked insufficient for future callers that do not want to use the callback interface, i.e. learn the pair with a single API call and then handle the data in that region itself, instead of preparing a callback function and calling read_chunk() on it. As C does not have closures, it gets quickly cumbersome if such a caller wants to share pieces of information with the callback function that is given to read_chunk(), but a caller that learns from pair_chunk() and then works on the region of memory itself do nto have to worry about that.