]> git.ipfire.org Git - thirdparty/git.git/commit
scalar: address -Wsign-compare warnings
authorPatrick Steinhardt <ps@pks.im>
Fri, 6 Dec 2024 10:27:30 +0000 (11:27 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 6 Dec 2024 11:20:05 +0000 (20:20 +0900)
commit89a0c5c024a53375a703a92dee11666d7ae11cd2
tree5302a5a2e663e115ca7bb4be99c58bcd7c9f869e
parentefb38ad49fb2dd7bf6e732df0c59f3c1aeba2f76
scalar: address -Wsign-compare warnings

There are two -Wsign-compare warnings in "scalar.c", both of which are
trivial:

  - We mistakenly use a signed integer to loop towards an upper unsigned
    bound in `cmd_reconfigure()`.

  - We subtract `path_sep - enlistment->buf`, which results in a signed
    integer, and use the value in a ternary expression where second
    value is unsigned. But as `path_sep` is being assigned the result of
    `find_last_dir_sep(enlistment->buf + offset)` we know that it must
    always be bigger than or equal to `enlistment->buf`, and thus the
    result will be positive.

Address both of these warnings.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
scalar.c