aboutsummaryrefslogtreecommitdiffstats
path: root/t/helper
diff options
context:
space:
mode:
Diffstat (limited to 't/helper')
-rw-r--r--t/helper/test-bloom.c10
-rw-r--r--t/helper/test-dump-fsmonitor.c4
-rw-r--r--t/helper/test-dump-split-index.c4
-rw-r--r--t/helper/test-dump-untracked-cache.c7
-rw-r--r--t/helper/test-hash-speed.c7
-rw-r--r--t/helper/test-parse-options.c7
-rw-r--r--t/helper/test-reach.c4
-rw-r--r--t/helper/test-ref-store.c4
-rw-r--r--t/helper/test-tool.c5
9 files changed, 14 insertions, 38 deletions
diff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c
index 8d4ef44131..14e075c1a1 100644
--- a/t/helper/test-bloom.c
+++ b/t/helper/test-bloom.c
@@ -1,5 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "test-tool.h"
#include "bloom.h"
@@ -12,30 +11,25 @@ static struct bloom_filter_settings settings = DEFAULT_BLOOM_FILTER_SETTINGS;
static void add_string_to_filter(const char *data, struct bloom_filter *filter) {
struct bloom_key key;
- int i;
fill_bloom_key(data, strlen(data), &key, &settings);
printf("Hashes:");
- for (i = 0; i < settings.num_hashes; i++){
+ for (size_t i = 0; i < settings.num_hashes; i++)
printf("0x%08x|", key.hashes[i]);
- }
printf("\n");
add_key_to_filter(&key, filter, &settings);
clear_bloom_key(&key);
}
static void print_bloom_filter(struct bloom_filter *filter) {
- int i;
-
if (!filter) {
printf("No filter.\n");
return;
}
printf("Filter_Length:%d\n", (int)filter->len);
printf("Filter_Data:");
- for (i = 0; i < filter->len; i++) {
+ for (size_t i = 0; i < filter->len; i++)
printf("%02x|", filter->data[i]);
- }
printf("\n");
}
diff --git a/t/helper/test-dump-fsmonitor.c b/t/helper/test-dump-fsmonitor.c
index 7b78f9d182..efd017ca35 100644
--- a/t/helper/test-dump-fsmonitor.c
+++ b/t/helper/test-dump-fsmonitor.c
@@ -1,5 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "test-tool.h"
#include "read-cache-ll.h"
@@ -9,7 +8,6 @@
int cmd__dump_fsmonitor(int ac UNUSED, const char **av UNUSED)
{
struct index_state *istate = the_repository->index;
- int i;
setup_git_directory();
if (do_read_index(istate, the_repository->index_file, 0) < 0)
@@ -20,7 +18,7 @@ int cmd__dump_fsmonitor(int ac UNUSED, const char **av UNUSED)
}
printf("fsmonitor last update %s\n", istate->fsmonitor_last_update);
- for (i = 0; i < istate->cache_nr; i++)
+ for (size_t i = 0; i < istate->cache_nr; i++)
printf((istate->cache[i]->ce_flags & CE_FSMONITOR_VALID) ? "+" : "-");
return 0;
diff --git a/t/helper/test-dump-split-index.c b/t/helper/test-dump-split-index.c
index f31b44a767..f855a3862c 100644
--- a/t/helper/test-dump-split-index.c
+++ b/t/helper/test-dump-split-index.c
@@ -1,5 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "test-tool.h"
#include "hex.h"
@@ -17,7 +16,6 @@ static void show_bit(size_t pos, void *data UNUSED)
int cmd__dump_split_index(int ac UNUSED, const char **av)
{
struct split_index *si;
- int i;
setup_git_directory();
@@ -29,7 +27,7 @@ int cmd__dump_split_index(int ac UNUSED, const char **av)
return 0;
}
printf("base %s\n", oid_to_hex(&si->base_oid));
- for (i = 0; i < the_repository->index->cache_nr; i++) {
+ for (size_t i = 0; i < the_repository->index->cache_nr; i++) {
struct cache_entry *ce = the_repository->index->cache[i];
printf("%06o %s %d\t%s\n", ce->ce_mode,
oid_to_hex(&ce->oid), ce_stage(ce), ce->name);
diff --git a/t/helper/test-dump-untracked-cache.c b/t/helper/test-dump-untracked-cache.c
index ae05795800..01a109496b 100644
--- a/t/helper/test-dump-untracked-cache.c
+++ b/t/helper/test-dump-untracked-cache.c
@@ -1,5 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "test-tool.h"
#include "dir.h"
@@ -24,7 +23,7 @@ static int compare_dir(const void *a_, const void *b_)
static void dump(struct untracked_cache_dir *ucd, struct strbuf *base)
{
- int i, len;
+ int len;
QSORT(ucd->untracked, ucd->untracked_nr, compare_untracked);
QSORT(ucd->dirs, ucd->dirs_nr, compare_dir);
len = base->len;
@@ -38,9 +37,9 @@ static void dump(struct untracked_cache_dir *ucd, struct strbuf *base)
if (ucd->valid)
fputs(" valid", stdout);
printf("\n");
- for (i = 0; i < ucd->untracked_nr; i++)
+ for (size_t i = 0; i < ucd->untracked_nr; i++)
printf("%s\n", ucd->untracked[i]);
- for (i = 0; i < ucd->dirs_nr; i++)
+ for (size_t i = 0; i < ucd->dirs_nr; i++)
dump(ucd->dirs[i], base);
strbuf_setlen(base, len);
}
diff --git a/t/helper/test-hash-speed.c b/t/helper/test-hash-speed.c
index 81a446dd64..80df1aae66 100644
--- a/t/helper/test-hash-speed.c
+++ b/t/helper/test-hash-speed.c
@@ -1,5 +1,3 @@
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "test-tool.h"
#include "hash.h"
@@ -18,12 +16,11 @@ int cmd__hash_speed(int ac, const char **av)
unsigned char hash[GIT_MAX_RAWSZ];
clock_t initial, start, end;
unsigned bufsizes[] = { 64, 256, 1024, 8192, 16384 };
- int i;
void *p;
const struct git_hash_algo *algo = NULL;
if (ac == 2) {
- for (i = 1; i < GIT_HASH_NALGOS; i++) {
+ for (size_t i = 1; i < GIT_HASH_NALGOS; i++) {
if (!strcmp(av[1], hash_algos[i].name)) {
algo = &hash_algos[i];
break;
@@ -38,7 +35,7 @@ int cmd__hash_speed(int ac, const char **av)
printf("algo: %s\n", algo->name);
- for (i = 0; i < ARRAY_SIZE(bufsizes); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(bufsizes); i++) {
unsigned long j, kb;
double kb_per_sec;
p = xcalloc(1, bufsizes[i]);
diff --git a/t/helper/test-parse-options.c b/t/helper/test-parse-options.c
index 25ba08a7c3..bfe45ec68b 100644
--- a/t/helper/test-parse-options.c
+++ b/t/helper/test-parse-options.c
@@ -1,5 +1,3 @@
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "test-tool.h"
#include "parse-options.h"
#include "strbuf.h"
@@ -176,7 +174,6 @@ int cmd__parse_options(int argc, const char **argv)
OPT_ALIAS('Z', "alias-target", "alias-source"),
OPT_END(),
};
- int i;
int ret = 0;
trace2_cmd_name("_parse_");
@@ -200,10 +197,10 @@ int cmd__parse_options(int argc, const char **argv)
show(&expect, &ret, "dry run: %s", dry_run ? "yes" : "no");
show(&expect, &ret, "file: %s", file ? file : "(not set)");
- for (i = 0; i < list.nr; i++)
+ for (size_t i = 0; i < list.nr; i++)
show(&expect, &ret, "list: %s", list.items[i].string);
- for (i = 0; i < argc; i++)
+ for (int i = 0; i < argc; i++)
show(&expect, &ret, "arg %02d: %s", i, argv[i]);
expect.strdup_strings = 1;
diff --git a/t/helper/test-reach.c b/t/helper/test-reach.c
index 25c232464d..01cf77ae65 100644
--- a/t/helper/test-reach.c
+++ b/t/helper/test-reach.c
@@ -1,5 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "test-tool.h"
#include "commit.h"
@@ -14,7 +13,6 @@
static void print_sorted_commit_ids(struct commit_list *list)
{
- int i;
struct string_list s = STRING_LIST_INIT_DUP;
while (list) {
@@ -24,7 +22,7 @@ static void print_sorted_commit_ids(struct commit_list *list)
string_list_sort(&s);
- for (i = 0; i < s.nr; i++)
+ for (size_t i = 0; i < s.nr; i++)
printf("%s\n", s.items[i].string);
string_list_clear(&s, 0);
diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c
index c5c4cb142d..1cc05f043a 100644
--- a/t/helper/test-ref-store.c
+++ b/t/helper/test-ref-store.c
@@ -1,5 +1,4 @@
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "test-tool.h"
#include "hex.h"
@@ -25,14 +24,13 @@ struct flag_definition {
static unsigned int parse_flags(const char *str, struct flag_definition *defs)
{
struct string_list masks = STRING_LIST_INIT_DUP;
- int i = 0;
unsigned int result = 0;
if (!strcmp(str, "0"))
return 0;
string_list_split(&masks, str, ',', 64);
- for (; i < masks.nr; i++) {
+ for (size_t i = 0; i < masks.nr; i++) {
const char *name = masks.items[i].string;
struct flag_definition *def = defs;
int found = 0;
diff --git a/t/helper/test-tool.c b/t/helper/test-tool.c
index b626f64eca..4a7aa993ba 100644
--- a/t/helper/test-tool.c
+++ b/t/helper/test-tool.c
@@ -1,5 +1,3 @@
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "git-compat-util.h"
#include "test-tool.h"
#include "test-tool-utils.h"
@@ -103,7 +101,6 @@ static NORETURN void die_usage(void)
int cmd_main(int argc, const char **argv)
{
- int i;
const char *working_directory = NULL;
struct option options[] = {
OPT_STRING('C', NULL, &working_directory, "directory",
@@ -122,7 +119,7 @@ int cmd_main(int argc, const char **argv)
if (working_directory && chdir(working_directory) < 0)
die("Could not cd to '%s'", working_directory);
- for (i = 0; i < ARRAY_SIZE(cmds); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(cmds); i++) {
if (!strcmp(cmds[i].name, argv[1])) {
argv++;
argc--;