global: trivial conversions to fix -Wsign-compare
warnings
We have a bunch of loops which iterate up to an unsigned boundary using a signed index, which generates warnigs because we compare a signed and unsigned value in the loop condition. Address these sites for trivial cases and enable `-Wsign-compare` warnings for these code units. This patch only adapts those code units where we can drop the `DISABLE_SIGN_COMPARE_WARNINGS` macro in the same step. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
25435e4ad8
commit
80c9e70ebe
@ -1,5 +1,4 @@
|
||||
#define USE_THE_REPOSITORY_VARIABLE
|
||||
#define DISABLE_SIGN_COMPARE_WARNINGS
|
||||
|
||||
#include "builtin.h"
|
||||
#include "tree-walk.h"
|
||||
@ -499,10 +498,9 @@ static int real_merge(struct merge_tree_options *o,
|
||||
if (!result.clean) {
|
||||
struct string_list conflicted_files = STRING_LIST_INIT_NODUP;
|
||||
const char *last = NULL;
|
||||
int i;
|
||||
|
||||
merge_get_conflicted_files(&result, &conflicted_files);
|
||||
for (i = 0; i < conflicted_files.nr; i++) {
|
||||
for (size_t i = 0; i < conflicted_files.nr; i++) {
|
||||
const char *name = conflicted_files.items[i].string;
|
||||
struct stage_info *c = conflicted_files.items[i].util;
|
||||
if (!o->name_only)
|
||||
@ -586,7 +584,7 @@ int cmd_merge_tree(int argc,
|
||||
|
||||
if (xopts.nr && o.mode == MODE_TRIVIAL)
|
||||
die(_("--trivial-merge is incompatible with all other options"));
|
||||
for (int x = 0; x < xopts.nr; x++)
|
||||
for (size_t x = 0; x < xopts.nr; x++)
|
||||
if (parse_merge_opt(&o.merge_options, xopts.v[x]))
|
||||
die(_("unknown strategy option: -X%s"), xopts.v[x]);
|
||||
|
||||
|
Reference in New Issue
Block a user