summaryrefslogtreecommitdiff
path: root/t/unit-tests/u-oid-array.c
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2025-03-19 18:23:50 -0400
committerJunio C Hamano <gitster@pobox.com>2025-03-21 01:38:41 -0700
commit572795cff930f11b1566f4f3e47fa9fa33772d1f (patch)
tree96084a1a96b6c6009ffd122de3a134658d2195b5 /t/unit-tests/u-oid-array.c
parent894221d2af0e2d218c5ce0a9e8246eadd3710fc7 (diff)
http.c: introduce `set_long_from_env()` for convenience
In 7059cd99fc (http_init(): Fix config file parsing, 2009-03-09), http.c gained a new "set_from_env()" function as a convenience function around conditionally assigning an environment variable to some variable if and only if the environment variable was set to begin with. But prior to 7059cd99fc, there were two spots which need to first strtol() whatever is set in the environment before assigning it to a long pointer. Both instances stored the result of getenv() in a temporary variable, and conditionally strtol() it depending on whether or not getenv() returned NULL. Replace those two instances with a new cousin of 'set_from_env()' called 'set_long_from_env()', which does what its name suggests. This allows us to remove the temporary variables and clean up some minor code duplication while also adding more robust error handling. More importantly, however, it prepares us for a future commit which will introduce more instances of assigning an environment variable to a long. Signed-off-by: Taylor Blau <me@ttaylorr.com> Acked-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/unit-tests/u-oid-array.c')
0 files changed, 0 insertions, 0 deletions