<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, 8 May 2021 at 17:50, Andrew Cagney <<a href="mailto:andrew.cagney@gmail.com" target="_blank">andrew.cagney@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br><br>
  extern pb_stream same_chunk_as_in_pbs(chunk_t chunk, const char *name);<br></blockquote><div><br></div><div>It should be renamed to:</div><div><br></div><div>  struct pbs_in chunk_as_pbs_in(chunk_t)</div><div>or</div><div>  struct pbs_in same_chunk_as_pbs_in(chunk_t)</div></div></div></blockquote><div><br></div><div>I went through and updated the names.  Hopefully pbs_in and pbs_out are used consistently.<br></div></div><div class="gmail_quote"><br></div><div class="gmail_quote">The convention {same,clone}_<foo>_as_<blah>() came out of an earlier discussion.  Because it was never really obvious if the handle being returned was referring to the same or a clone of the buffer, it was spelt out.<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">This buffer sharing is also why <blah>_from_<foo>() struggled.  For addresses, functions are pure so:<br></div><div class="gmail_quote">    selector_from_address()</div><div class="gmail_quote">is pretty clear.  Not so when there's an underlying buffer.  While technically shunk_from_pbs_out() has to return the same buffer (since a shunk can't be freed it must be shared, right), chunk_from_pbs_out() feels like it returned a clone ...., and chunk_for_pbs_out() makes me wonder if I'm feeding the pbs chocolate chunk cookies.</div><div class="gmail_quote"><br></div><div class="gmail_quote">On the bright side, it looks like same_pbs_out_as_chunk() can be eliminated.<br></div><br><div class="gmail_quote"><br></div><div class="gmail_quote"> <br></div><div class="gmail_quote"><div><br></div></div></div>