summaryrefslogtreecommitdiff
path: root/sideband.h
diff options
context:
space:
mode:
authorLibravatar Giuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-11-29 13:07:29 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2008-11-30 18:15:52 -0800
commit25b2790fff5b7b484f1a2f40fafa4b24db1506a2 (patch)
tree46329ffbcab6d9f26d19a230f288b51978d5777c /sideband.h
parentgitweb: rename gitweb_check_feature to gitweb_get_feature (diff)
downloadtgif-25b2790fff5b7b484f1a2f40fafa4b24db1506a2.tar.xz
gitweb: make gitweb_check_feature a boolean wrapper
The gitweb_get_feature() function retrieves the configuration parameters for the feature (such as the list of snapshot formats or the list of additional actions), but it is very often used to see if feature is enabled (which is returned as the first element in the list). Because accepting the returned list in the scalar context by mistake yields the number of elements in the array, which is non-zero in all cases, such a mistake would result in a bug for the latter use, with disabled features appearing enabled. All existing callers that call the function for this purpose assign the return value in the list context to retrieve the first element, but that is only because we fixed careless callers recently. This adds gitweb_check_feature() as a wrapper to gitweb_get_feature() that can be called safely in the scalar context to see if a feature is enabled to reduce the risk of future bugs. Callers of "get" that use the call only to see if the feature is enabled are updated to call this wrapper. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sideband.h')
0 files changed, 0 insertions, 0 deletions