Thread (2 messages) flat view 2 messages, 2 authors, 2016-11-28

Re: [PATCH v1 15/19] config: add git_config_get_date_string() from gc.c

From: Christian Couder <hidden>
Date: 2016-11-28 16:19:24

On Wed, Nov 23, 2016 at 6:34 PM, Junio C Hamano [off-list ref] wrote:
Christian Couder [off-list ref] writes:
quoted
Ok it will appear like this in cache.h:

/* This dies if the configured or default date is in the future */
extern int git_config_get_expire_date_string(const char *key, const
char **output);
Those who imitate existing callsites never read comments, and you
need to spend effort to get the name right to protect the codebase
from them.

"get-expiry" may be shorter.  Neither still does not say it will
die, though.
What about something like this then:

/* This dies if the configured or default date is in the future */
extern int git_config_get_expiry_or_die(const char *key, const char **output);

Also git_config_get_int(), git_config_get_bool() and probably other
such functions are indirectly calling git_config_int() which die()s is
the value is not a number, so it feels a bit strange to have only one
function with a name that ends with "_or_die" when many other
functions could die(). In fact it could give a false sense of security
to those who just read cache.h.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help