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 "git-compat-util.h"
|
||||
#include "tag.h"
|
||||
@@ -284,7 +283,6 @@ void mark_edges_uninteresting(struct rev_info *revs,
|
||||
int sparse)
|
||||
{
|
||||
struct commit_list *list;
|
||||
int i;
|
||||
|
||||
if (sparse) {
|
||||
struct oidset set;
|
||||
@@ -321,7 +319,7 @@ void mark_edges_uninteresting(struct rev_info *revs,
|
||||
}
|
||||
|
||||
if (revs->edge_hint_aggressive) {
|
||||
for (i = 0; i < revs->cmdline.nr; i++) {
|
||||
for (size_t i = 0; i < revs->cmdline.nr; i++) {
|
||||
struct object *obj = revs->cmdline.rev[i].item;
|
||||
struct commit *commit = (struct commit *)obj;
|
||||
if (obj->type != OBJ_COMMIT || !(obj->flags & UNINTERESTING))
|
||||
@@ -344,11 +342,9 @@ static void add_pending_tree(struct rev_info *revs, struct tree *tree)
|
||||
static void traverse_non_commits(struct traversal_context *ctx,
|
||||
struct strbuf *base)
|
||||
{
|
||||
int i;
|
||||
|
||||
assert(base->len == 0);
|
||||
|
||||
for (i = 0; i < ctx->revs->pending.nr; i++) {
|
||||
for (size_t i = 0; i < ctx->revs->pending.nr; i++) {
|
||||
struct object_array_entry *pending = ctx->revs->pending.objects + i;
|
||||
struct object *obj = pending->item;
|
||||
const char *name = pending->name;
|
||||
|
||||
Reference in New Issue
Block a user