On Tue, May 22, 2018 at 7:49 PM, Ævar Arnfjörð Bjarmason
<ava...@gmail.com> wrote:
>
> On Wed, May 16 2018, Stefan Beller wrote:
>
>> A common pattern with the repo_read_index function is to die if the return
>> of repo_read_index is negative.  Move this pattern into a function.
>
> Just a side-question unrelated to this patch per-se, why do we have both
> x*() and *_or_die() functions in the codebase?

I wondered about that myself shortly after suggesting
repo_read_index_or_die(). My only guess is xfoo is better version of
foo, which sometimes involves dying inside but that's not the only
possible improvement. Later I guess people go with _or_die() more
because it describes what the function does much better.

> I can't find any pattern
> for one or the other, e.g. we have both xopen() and then write_or_die(),
> so it's not a matter of x*() just being for syscalls and *_or_die()
> being for our own functions (also as e.g. strbuf uses x*(), not
> *_or_die()).
>
> I'm not trying to litigate the difference and understand it could have
> just emerged organically. I'm just wondering if that's the full story or
> if one is preferred, or we prefer one or the other in some
> circumstances.



-- 
Duy

Reply via email to