From: Jeff King Date: Mon, 25 Sep 2017 23:27:06 GMT Subject: Re: [PATCH 7/7] add xread_in_full() helper Message-ID: <20170925232706.ulrefbv623tinukf@sigill.intra.peff.net> In-Reply-To: <20170925221608.GF27425@aiede.mtv.corp.google.com> On Mon, Sep 25, 2017 at 03:16:08PM -0700, Jonathan Nieder wrote: > Jeff King wrote: > > > Many callers of read_in_full() expect to see exactly "len" > > bytes, and die if that isn't the case. > > micronit: Can this be named read_in_full_or_die? > > Otherwise it's too easy to mistake for a function like xread, which > has different semantics. > > I realize that xmalloc, xmemdupz, etc use a different convention. > That's yet another reason to be explicit, IMHO. Yeah, we've definitely misused the "x" prefix for different things. I agree that being explicit probably can't hurt. I wonder if it's worth calling it "read_exactly_or_die()" to emphasize that not reading enough bytes is a die-able offense. -Peff