Re: [PATCH 1/2] config: return positive from git_config_parse_key()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 21, 2023, 16:36 UTC
- Message-ID
- <xmqqa5vpw7b7.fsf@gitster.g>
- In-Reply-To
- <kl6ltttxz1jj.fsf@chooglen-macbookpro.roam.corp.google.com>
Glen Choo <chooglen@google.com> writes:
Show 5 quoted lines
> Oh, interesting. I was trying to follow the conventions of the > surrounding config.c code and many other parts of the codebase, which > returns positive values. Why do we choose to return postive values > throughout the codebase, by the way? Is it because they were really > intended for exit(3), and not to be used as a library.
If config.c does that, I'd say that was poorly designed oddball. Looking at read-cache.c (which is older parts of the codebase written back when the developer base was smaller) may give you a better examples to follow. After all, error() returns negative exactly because we want to follow the usual "negative is an error" convention.