-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "git-compat-util.h"
#include "advice.h"
#include "config.h"
int git_default_advice_config(const char *var, const char *value)
{
const char *k, *slot_name;
- int i;
if (!strcmp(var, "color.advice")) {
advice_use_color = git_config_colorbool(var, value);
if (!skip_prefix(var, "advice.", &k))
return 0;
- for (i = 0; i < ARRAY_SIZE(advice_setting); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(advice_setting); i++) {
if (strcasecmp(k, advice_setting[i].key))
continue;
advice_setting[i].level = git_config_bool(var, value)
void list_config_advices(struct string_list *list, const char *prefix)
{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(advice_setting); i++)
+ for (size_t i = 0; i < ARRAY_SIZE(advice_setting); i++)
list_config_item(list, prefix, advice_setting[i].key);
}
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "git-compat-util.h"
#include "base85.h"
static char de85[256];
static void prep_base85(void)
{
- int i;
if (de85['Z'])
return;
- for (i = 0; i < ARRAY_SIZE(en85); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(en85); i++) {
int ch = en85[i];
de85[ch] = i + 1;
}
* Copyright (C) 2006 Linus Torvalds
*/
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "builtin.h"
#include "advice.h"
#include "config.h"
char flip,
int show_only)
{
- int i, ret = 0;
+ int ret = 0;
- for (i = 0; i < repo->index->cache_nr; i++) {
+ for (size_t i = 0; i < repo->index->cache_nr; i++) {
struct cache_entry *ce = repo->index->cache[i];
int err;
const struct pathspec *pathspec,
int flags)
{
- int i, retval = 0;
+ int retval = 0;
- for (i = 0; i < repo->index->cache_nr; i++) {
+ for (size_t i = 0; i < repo->index->cache_nr; i++) {
struct cache_entry *ce = repo->index->cache[i];
if (!include_sparse &&
*/
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
*/
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
char *lbase_dir = NULL, *rbase_dir = NULL;
size_t ldir_len, rdir_len, wtdir_len;
const char *workdir, *tmp;
- int ret = 0, i;
+ int ret = 0;
+ size_t i;
FILE *fp = NULL;
struct hashmap working_tree_dups = HASHMAP_INIT(working_tree_entry_cmp,
NULL);
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
{
static const char *config_key = NULL;
int keep_going = 0;
- int i, result = 0;
+ int result = 0;
const struct string_list *values;
int err;
else if (err)
return 0;
- for (i = 0; i < values->nr; i++) {
+ for (size_t i = 0; i < values->nr; i++) {
int ret = run_command_on_repo(values->items[i].string, argc, argv);
if (ret) {
if (!keep_going)
*/
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
struct string_list keys = STRING_LIST_INIT_DUP;
struct string_list keys_uniq = STRING_LIST_INIT_DUP;
struct string_list_item *item;
- int i;
for (p = config_name_list; *p; p++) {
const char *var = *p;
e->prefix, e->placeholder);
string_list_sort(&keys);
- for (i = 0; i < keys.nr; i++) {
+ for (size_t i = 0; i < keys.nr; i++) {
const char *var = keys.items[i].string;
const char *wildcard, *tag, *cut;
const char *dot = NULL;
char *file = NULL;
FILE *f = NULL;
int ret = -1;
- int i;
struct string_list list = STRING_LIST_INIT_DUP;
list.cmp = maildir_filename_cmp;
if (populate_maildir_list(&list, maildir) < 0)
goto out;
- for (i = 0; i < list.nr; i++) {
+ for (size_t i = 0; i < list.nr; i++) {
char *name;
free(file);
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "tree-walk.h"
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)
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]);
*/
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "gettext.h"
static void sort_pack_list(struct pack_list **pl)
{
struct pack_list **ary, *p;
- int i;
size_t n = pack_list_size(*pl);
if (n < 2)
QSORT(ary, n, cmp_remaining_objects);
/* link them back again */
- for (i = 0; i < n - 1; i++)
+ for (size_t i = 0; i < n - 1; i++)
ary[i]->next = ary[i + 1];
ary[n - 1]->next = NULL;
*pl = ary[0];
*/
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "advice.h"
static int already_up_to_date(struct object_id *orig_head,
struct oid_array *merge_heads)
{
- int i;
struct commit *ours;
ours = lookup_commit_reference(the_repository, orig_head);
- for (i = 0; i < merge_heads->nr; i++) {
+ for (size_t i = 0; i < merge_heads->nr; i++) {
struct commit_list *list = NULL;
struct commit *theirs;
int ok;
*/
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "advice.h"
const struct string_list *push_options,
struct remote *remote)
{
- int i, errs;
+ int errs;
struct strvec *url;
struct refspec *push_refspec = &rs;
}
errs = 0;
url = push_url_of_remote(remote);
- for (i = 0; i < url->nr; i++) {
+ for (size_t i = 0; i < url->nr; i++) {
struct transport *transport =
transport_get(remote, url->v[i]);
if (flags & TRANSPORT_PUSH_OPTIONS)
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
struct repository *repo UNUSED)
{
struct string_list merge_rr = STRING_LIST_INIT_DUP;
- int i, autoupdate = -1, flags = 0;
+ int autoupdate = -1, flags = 0;
struct option options[] = {
OPT_SET_INT(0, "rerere-autoupdate", &autoupdate,
if (setup_rerere(the_repository, &merge_rr,
flags | RERERE_READONLY) < 0)
return 0;
- for (i = 0; i < merge_rr.nr; i++)
+ for (size_t i = 0; i < merge_rr.nr; i++)
printf("%s\n", merge_rr.items[i].string);
} else if (!strcmp(argv[0], "remaining")) {
rerere_remaining(the_repository, &merge_rr);
- for (i = 0; i < merge_rr.nr; i++) {
+ for (size_t i = 0; i < merge_rr.nr; i++) {
if (merge_rr.items[i].util != RERERE_RESOLVED)
printf("%s\n", merge_rr.items[i].string);
else
if (setup_rerere(the_repository, &merge_rr,
flags | RERERE_READONLY) < 0)
return 0;
- for (i = 0; i < merge_rr.nr; i++) {
+ for (size_t i = 0; i < merge_rr.nr; i++) {
const char *path = merge_rr.items[i].string;
const struct rerere_id *id = merge_rr.items[i].util;
if (diff_two(rerere_path(id, "preimage"), path, path, path))
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "abspath.h"
struct tree *tree[ARRAY_SIZE(oid)];
struct tree_desc tree_desc[ARRAY_SIZE(oid)];
struct unpack_trees_options unpack_tree_opt = { 0 };
- int i;
- for (i = 0; i < ARRAY_SIZE(oid); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(oid); i++) {
tree[i] = parse_tree_indirect(oid[i]);
if (parse_tree(tree[i]) < 0)
die(_("failed to parse tree"));
repo_read_index_preload(the_repository, NULL, 0);
if (!include_untracked && ps->nr) {
- int i;
char *ps_matched = xcalloc(ps->nr, 1);
/* TODO: audit for interaction with sparse-index. */
ensure_full_index(the_repository->index);
- for (i = 0; i < the_repository->index->cache_nr; i++)
+ for (size_t i = 0; i < the_repository->index->cache_nr; i++)
ce_path_match(the_repository->index, the_repository->index->cache[i], ps,
ps_matched);
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "abspath.h"
struct pathspec *pathspec,
struct module_list *list)
{
- int i, result = 0;
+ int result = 0;
char *ps_matched = NULL;
parse_pathspec(pathspec, 0,
if (repo_read_index(the_repository) < 0)
die(_("index file corrupt"));
- for (i = 0; i < the_repository->index->cache_nr; i++) {
+ for (size_t i = 0; i < the_repository->index->cache_nr; i++) {
const struct cache_entry *ce = the_repository->index->cache[i];
if (!match_pathspec(the_repository->index, pathspec, ce->name, ce_namelen(ce),
die(_("index file corrupt"));
if (ps.nr) {
- int i;
char *ps_matched = xcalloc(ps.nr, 1);
/* TODO: audit for interaction with sparse-index. */
* Since there is only one pathspec, we just need to
* check ps_matched[0] to know if a cache entry matched.
*/
- for (i = 0; i < the_repository->index->cache_nr; i++) {
+ for (size_t i = 0; i < the_repository->index->cache_nr; i++) {
ce_path_match(the_repository->index, the_repository->index->cache[i], &ps,
ps_matched);
*/
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
if ((val = ptr->read(0))) {
if (ptr->multivalued && *val) {
struct string_list list = STRING_LIST_INIT_DUP;
- int i;
string_list_split(&list, val, '\n', -1);
- for (i = 0; i < list.nr; i++)
+ for (size_t i = 0; i < list.nr; i++)
printf("%s=%s\n", ptr->name, list.items[i].string);
string_list_clear(&list, 0);
} else {
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "tag.h"
{ &compat_sig, r->compat_hash_algo },
{ &sig, r->hash_algo },
};
- int i;
/*
* We write algorithms in the order they were implemented in
* We traverse each algorithm in order, and apply the signature
* to each buffer.
*/
- for (i = 0; i < ARRAY_SIZE(bufs); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(bufs); i++) {
if (!bufs[i].algo)
continue;
add_header_signature(&buffer, bufs[i].sig, bufs[i].algo);
#endif
#endif
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "git-compat-util.h"
#include "fsmonitor-ll.h"
#include "fsm-listen.h"
const char *slash;
char *resolved = NULL;
struct strbuf tmp = STRBUF_INIT;
- int k;
/*
* Build a list of all filesystem changes into a private/local
* list and without holding any locks.
*/
- for (k = 0; k < num_of_events; k++) {
+ for (size_t k = 0; k < num_of_events; k++) {
/*
* On Mac, we receive an array of absolute paths.
*/
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "git-compat-util.h"
#include "compat/terminal.h"
#include "gettext.h"
void restore_term(void)
{
if (use_stty) {
- int i;
struct child_process cp = CHILD_PROCESS_INIT;
if (stty_restore.nr == 0)
return;
strvec_push(&cp.args, "stty");
- for (i = 0; i < stty_restore.nr; i++)
+ for (size_t i = 0; i < stty_restore.nr; i++)
strvec_push(&cp.args, stty_restore.items[i].string);
run_command(&cp);
string_list_clear(&stty_restore, 0);
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "diagnose.h"
int option_parse_diagnose(const struct option *opt, const char *arg, int unset)
{
- int i;
enum diagnose_mode *diagnose = opt->value;
if (!arg) {
return 0;
}
- for (i = 0; i < ARRAY_SIZE(diagnose_options); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(diagnose_options); i++) {
if (!strcmp(arg, diagnose_options[i].option_name)) {
*diagnose = diagnose_options[i].mode;
return 0;
char **argv_copy = NULL;
int stdout_fd = -1, archiver_fd = -1;
struct strbuf buf = STRBUF_INIT;
- int res, i;
+ int res;
struct archive_dir archive_dirs[] = {
{ ".git", 0 },
{ ".git/hooks", 0 },
/* Only include this if explicitly requested */
if (mode == DIAGNOSE_ALL) {
- for (i = 0; i < ARRAY_SIZE(archive_dirs); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(archive_dirs); i++) {
if (add_directory_to_archiver(&archiver_args,
archive_dirs[i].path,
archive_dirs[i].recursive)) {
*/
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "diff.h"
struct hashmap_iter iter;
struct strmap_entry *entry;
struct string_list to_remove = STRING_LIST_INIT_NODUP;
- int i;
if (!info->setup)
return;
if (strintmap_contains(counts, UNKNOWN_DIR))
strintmap_remove(counts, UNKNOWN_DIR);
}
- for (i = 0; i < to_remove.nr; ++i)
+ for (size_t i = 0; i < to_remove.nr; ++i)
strmap_remove(info->dir_rename_count,
to_remove.items[i].string, 1);
string_list_clear(&to_remove, 0);
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "object-store-ll.h"
static void mark_colliding_entries(const struct checkout *state,
struct cache_entry *ce, struct stat *st)
{
- int i, trust_ino = check_stat;
+ int trust_ino = check_stat;
#if defined(GIT_WINDOWS_NATIVE) || defined(__CYGWIN__)
trust_ino = 0;
/* TODO: audit for interaction with sparse-index. */
ensure_full_index(state->istate);
- for (i = 0; i < state->istate->cache_nr; i++) {
+ for (size_t i = 0; i < state->istate->cache_nr; i++) {
struct cache_entry *dup = state->istate->cache[i];
if (dup == ce) {
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "git-compat-util.h"
#include "ewok.h"
#include "ewok_rlw.h"
++pointer;
for (k = 0; k < rlw_get_literal_words(word); ++k) {
- int c;
-
/* todo: zero count optimization */
- for (c = 0; c < BITS_IN_EWORD; ++c, ++pos) {
+ for (size_t c = 0; c < BITS_IN_EWORD; ++c, ++pos) {
if ((self->buffer[pointer] & ((eword_t)1 << c)) != 0)
callback(pos, payload);
}
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "builtin.h"
#include "config.h"
static void exclude_helpers_from_list(struct string_list *list)
{
- int i = 0;
+ size_t i = 0;
while (i < list->nr) {
if (strstr(list->items[i].string, "--"))
static int list_cmds(const char *spec)
{
struct string_list list = STRING_LIST_INIT_DUP;
- int i;
int nongit;
/*
if (*spec == ',')
spec++;
}
- for (i = 0; i < list.nr; i++)
+ for (size_t i = 0; i < list.nr; i++)
puts(list.items[i].string);
string_list_clear(&list, 0);
return 0;
trace2_cmd_name("_query_");
if (!strcmp(cmd, "parseopt")) {
struct string_list list = STRING_LIST_INIT_DUP;
- int i;
list_builtins(&list, NO_PARSEOPT);
- for (i = 0; i < list.nr; i++)
+ for (size_t i = 0; i < list.nr; i++)
printf("%s ", list.items[i].string);
string_list_clear(&list, 0);
exit(0);
static struct cmd_struct *get_builtin(const char *s)
{
- int i;
- for (i = 0; i < ARRAY_SIZE(commands); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(commands); i++) {
struct cmd_struct *p = commands + i;
if (!strcmp(s, p->cmd))
return p;
static void list_builtins(struct string_list *out, unsigned int exclude_option)
{
- int i;
- for (i = 0; i < ARRAY_SIZE(commands); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(commands); i++) {
if (exclude_option &&
(commands[i].option & exclude_option))
continue;
void load_builtin_commands(const char *prefix, struct cmdnames *cmds)
{
const char *name;
- int i;
/*
* Callers can ask for a subset of the commands based on a certain
if (!skip_prefix(prefix, "git-", &prefix))
BUG("prefix '%s' must start with 'git-'", prefix);
- for (i = 0; i < ARRAY_SIZE(commands); i++)
+ for (size_t i = 0; i < ARRAY_SIZE(commands); i++)
if (skip_prefix(commands[i].cmd, prefix, &name))
add_cmdname(cmds, name, strlen(name));
}
handle_builtin(args);
else if (get_builtin(args->v[0])) {
struct child_process cmd = CHILD_PROCESS_INIT;
- int i;
+ int err;
/*
* The current process is committed to launching a
commit_pager_choice();
strvec_push(&cmd.args, "git");
- for (i = 0; i < args->nr; i++)
+ for (size_t i = 0; i < args->nr; i++)
strvec_push(&cmd.args, args->v[i]);
trace_argv_printf(cmd.args.v, "trace: exec:");
cmd.clean_on_exit = 1;
cmd.wait_after_clean = 1;
cmd.trace2_child_class = "git_alias";
- i = run_command(&cmd);
- if (i >= 0 || errno != ENOENT)
- exit(i);
+ err = run_command(&cmd);
+ if (err >= 0 || errno != ENOENT)
+ exit(err);
die("could not execute builtin %s", args->v[0]);
}
seen = unsorted_string_list_lookup(&cmd_list, args->v[0]);
if (seen) {
- int i;
struct strbuf sb = STRBUF_INIT;
- for (i = 0; i < cmd_list.nr; i++) {
+ for (size_t i = 0; i < cmd_list.nr; i++) {
struct string_list_item *item = &cmd_list.items[i];
strbuf_addf(&sb, "\n %s", item->string);
*/
setup_path();
- for (size_t i = 0; i < argc; i++)
+ for (int i = 0; i < argc; i++)
strvec_push(&args, argv[i]);
while (1) {
#define define_list_config_array(array) \
void list_config_##array(struct string_list *list, const char *prefix) \
{ \
- int i; \
- for (i = 0; i < ARRAY_SIZE(array); i++) \
+ for (size_t i = 0; i < ARRAY_SIZE(array); i++) \
if (array[i]) \
list_config_item(list, prefix, array[i]); \
} \
#define define_list_config_array_extra(array, values) \
void list_config_##array(struct string_list *list, const char *prefix) \
{ \
- int i; \
static const char *extra[] = values; \
- for (i = 0; i < ARRAY_SIZE(extra); i++) \
+ for (size_t i = 0; i < ARRAY_SIZE(extra); i++) \
list_config_item(list, prefix, extra[i]); \
- for (i = 0; i < ARRAY_SIZE(array); i++) \
+ for (size_t i = 0; i < ARRAY_SIZE(array); i++) \
if (array[i]) \
list_config_item(list, prefix, array[i]); \
} \
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "hash.h"
static int get_hash_hex_algop(const char *hex, unsigned char *hash,
const struct git_hash_algo *algop)
{
- int i;
- for (i = 0; i < algop->rawsz; i++) {
+ for (size_t i = 0; i < algop->rawsz; i++) {
int val = hex2chr(hex);
if (val < 0)
return -1;
{
static const char hex[] = "0123456789abcdef";
char *buf = buffer;
- int i;
/*
* Our struct object_id has been memset to 0, so default to printing
if (algop == &hash_algos[0])
algop = the_hash_algo;
- for (i = 0; i < algop->rawsz; i++) {
+ for (size_t i = 0; i < algop->rawsz; i++) {
unsigned int val = *hash++;
*buf++ = hex[val >> 4];
*buf++ = hex[val & 0xf];
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "environment.h"
static int get_delta(struct rev_info *revs, struct remote_lock *lock)
{
- int i;
struct commit *commit;
struct object_list **p = &objects;
int count = 0;
count += add_send_request(&commit->object, lock);
}
- for (i = 0; i < revs->pending.nr; i++) {
+ for (size_t i = 0; i < revs->pending.nr; i++) {
struct object_array_entry *entry = revs->pending.objects + i;
struct object *obj = entry->item;
const char *name = entry->name;
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "config.h"
struct list_objects_filter_options *dest,
const struct list_objects_filter_options *src)
{
- int i;
-
/* Copy everything. We will overwrite the pointers shortly. */
memcpy(dest, src, sizeof(struct list_objects_filter_options));
dest->sparse_oid_name = xstrdup_or_null(src->sparse_oid_name);
ALLOC_ARRAY(dest->sub, dest->sub_alloc);
- for (i = 0; i < src->sub_nr; i++)
+ for (size_t i = 0; i < src->sub_nr; i++)
list_objects_filter_copy(&dest->sub[i], &src->sub[i]);
}
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "tag.h"
int sparse)
{
struct commit_list *list;
- int i;
if (sparse) {
struct oidset set;
}
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))
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;
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "environment.h"
*/
static int ref_match(const struct strvec *prefixes, const char *refname)
{
- int i;
-
if (!prefixes->nr)
return 1; /* no restriction */
- for (i = 0; i < prefixes->nr; i++) {
+ for (size_t i = 0; i < prefixes->nr; i++) {
const char *prefix = prefixes->v[i];
if (starts_with(refname, prefix))
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "gettext.h"
const char *head_arg, struct commit_list *remotes)
{
struct child_process cmd = CHILD_PROCESS_INIT;
- int i, ret;
+ int ret;
struct commit_list *j;
strvec_pushf(&cmd.args, "merge-%s", strategy);
- for (i = 0; i < xopts_nr; i++)
+ for (size_t i = 0; i < xopts_nr; i++)
strvec_pushf(&cmd.args, "--%s", xopts[i]);
for (j = common; j; j = j->next)
strvec_push(&cmd.args, merge_argument(j->item));
*/
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "abspath.h"
*/
int longest_ancestor_length(const char *path, struct string_list *prefixes)
{
- int i, max_len = -1;
+ int max_len = -1;
if (!strcmp(path, "/"))
return -1;
- for (i = 0; i < prefixes->nr; i++) {
+ for (size_t i = 0; i < prefixes->nr; i++) {
const char *ceil = prefixes->items[i].string;
int len = strlen(ceil);
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "git-compat-util.h"
#include "copy.h"
#include "pkt-line.h"
static void packet_trace(const char *buf, unsigned int len, int write)
{
- int i;
struct strbuf out;
static int in_pack, sideband;
get_trace_prefix(), write ? '>' : '<');
/* XXX we should really handle printable utf8 */
- for (i = 0; i < len; i++) {
+ for (unsigned int i = 0; i < len; i++) {
/* suppress newlines */
if (buf[i] == '\n')
continue;
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "git-compat-util.h"
#include "hex.h"
#include "refs-internal.h"
static void print_transaction(struct ref_transaction *transaction)
{
- int i;
trace_printf_key(&trace_refs, "transaction {\n");
- for (i = 0; i < transaction->nr; i++) {
+ for (size_t i = 0; i < transaction->nr; i++) {
struct ref_update *u = transaction->updates[i];
print_update(i, u->refname, &u->old_oid, &u->new_oid, u->flags,
u->type, u->msg);
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "config.h"
*/
struct child_process po = CHILD_PROCESS_INIT;
FILE *po_in;
- int i;
int rc;
trace2_region_enter("send_pack", "pack_objects", the_repository);
* parameters by writing to the pipe.
*/
po_in = xfdopen(po.in, "w");
- for (i = 0; i < advertised->nr; i++)
+ for (size_t i = 0; i < advertised->nr; i++)
feed_object(&advertised->oid[i], po_in, 1);
- for (i = 0; i < negotiated->nr; i++)
+ for (size_t i = 0; i < negotiated->nr; i++)
feed_object(&negotiated->oid[i], po_in, 1);
while (refs) {
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "repository.h"
{
struct strbuf capability = STRBUF_INIT;
struct strbuf value = STRBUF_INIT;
- int i;
/* serve by default supports v2 */
packet_write_fmt(1, "version 2\n");
- for (i = 0; i < ARRAY_SIZE(capabilities); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(capabilities); i++) {
struct protocol_capability *c = &capabilities[i];
if (c->advertise(the_repository, &value)) {
static struct protocol_capability *get_capability(const char *key, const char **value)
{
- int i;
-
if (!key)
return NULL;
- for (i = 0; i < ARRAY_SIZE(capabilities); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(capabilities); i++) {
struct protocol_capability *c = &capabilities[i];
const char *out;
if (!skip_prefix(key, c->name, &out))
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "git-compat-util.h"
#include "strvec.h"
#include "strbuf.h"
void strvec_clear(struct strvec *array)
{
if (array->v != empty_strvec) {
- int i;
- for (i = 0; i < array->nr; i++)
+ for (size_t i = 0; i < array->nr; i++)
free((char *)array->v[i]);
free(array->v);
}
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "test-tool.h"
#include "bloom.h"
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");
}
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "test-tool.h"
#include "read-cache-ll.h"
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)
}
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;
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "test-tool.h"
#include "hex.h"
int cmd__dump_split_index(int ac UNUSED, const char **av)
{
struct split_index *si;
- int i;
setup_git_directory();
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);
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "test-tool.h"
#include "dir.h"
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;
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);
}
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "test-tool.h"
#include "hash.h"
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;
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]);
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "test-tool.h"
#include "parse-options.h"
#include "strbuf.h"
OPT_ALIAS('Z', "alias-target", "alias-source"),
OPT_END(),
};
- int i;
int ret = 0;
trace2_cmd_name("_parse_");
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;
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "test-tool.h"
#include "commit.h"
static void print_sorted_commit_ids(struct commit_list *list)
{
- int i;
struct string_list s = STRING_LIST_INIT_DUP;
while (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);
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "test-tool.h"
#include "hex.h"
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;
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "git-compat-util.h"
#include "test-tool.h"
#include "test-tool-utils.h"
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",
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--;
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "test-lib.h"
#include "object.h"
static void t_loop(struct test_vars *vars)
{
- int i, objects_noticed = 0;
+ int objects_noticed = 0;
- for (i = 0; i < vars->n.size; i++) {
+ for (size_t i = 0; i < vars->n.size; i++) {
if (vars->n.entries[i].base)
objects_noticed++;
}
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "test-lib.h"
#include "prio-queue.h"
struct prio_queue pq = { intcmp };
int j = 0;
- for (int i = 0; i < input_size; i++) {
+ for (size_t i = 0; i < input_size; i++) {
void *peek, *get;
switch(input[i]) {
case GET:
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "tmp-objdir.h"
{
size_t src_len = src->len, dst_len = dst->len;
struct string_list paths = STRING_LIST_INIT_DUP;
- int i;
int ret = 0;
if (read_dir_paths(&paths, src->buf) < 0)
paths.cmp = pack_copy_cmp;
string_list_sort(&paths);
- for (i = 0; i < paths.nr; i++) {
+ for (size_t i = 0; i < paths.nr; i++) {
const char *name = paths.items[i].string;
enum finalize_object_file_flags flags_copy = flags;
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "config.h"
struct conf_info *conf;
char *name = NULL;
enum trailer_info_type type;
- int i;
if (!skip_prefix(conf_key, "trailer.", &trailer_item))
return 0;
return 0;
variable_name++;
- for (i = 0; i < ARRAY_SIZE(trailer_config_items); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(trailer_config_items); i++) {
if (strcmp(trailer_config_items[i].name, variable_name))
continue;
name = xstrndup(trailer_item, variable_name - trailer_item - 1);
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "transport.h"
struct string_list *list)
{
struct strbuf buf = STRBUF_INIT;
- int i, ret = 0;
+ int ret = 0;
- for (i = 0; i < list->nr; i++) {
+ for (size_t i = 0; i < list->nr; i++) {
strbuf_addf(&buf, "option %s ", name);
quote_c_style(list->items[i].string, &buf, NULL, 0);
strbuf_addch(&buf, '\n');
{
struct helper_data *data = transport->data;
struct strbuf buf = STRBUF_INIT;
- int i, ret, is_bool = 0;
+ int ret, is_bool = 0;
get_helper(transport);
return string_list_set_helper_option(data, name,
(struct string_list *)value);
- for (i = 0; i < ARRAY_SIZE(unsupported_options); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(unsupported_options); i++) {
if (!strcmp(name, unsupported_options[i]))
return 1;
}
- for (i = 0; i < ARRAY_SIZE(boolean_options); i++) {
+ for (size_t i = 0; i < ARRAY_SIZE(boolean_options); i++) {
if (!strcmp(name, boolean_options[i])) {
is_bool = 1;
break;
{
struct helper_data *data = transport->data;
struct child_process *helper = get_helper(transport);
- int i;
child_process_init(fastexport);
if (data->import_marks)
strvec_pushf(&fastexport->args, "--import-marks=%s", data->import_marks);
- for (i = 0; i < revlist_args->nr; i++)
+ for (size_t i = 0; i < revlist_args->nr; i++)
strvec_push(&fastexport->args, revlist_args->items[i].string);
fastexport->git_cmd = 1;
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "advice.h"
"color.transport.rejected"
}, *key = "color.transport";
char *value;
- int i;
static int initialized;
if (initialized)
if (!want_color_stderr(transport_use_color))
return 0;
- for (i = 0; i < ARRAY_SIZE(keys); i++)
+ for (size_t i = 0; i < ARRAY_SIZE(keys); i++)
if (!git_config_get_string(keys[i], &value)) {
if (!value)
return config_error_nonbool(keys[i]);
{
struct bundle_transport_data *data = transport->data;
struct ref *result = NULL;
- int i;
if (for_push)
return NULL;
get_refs_from_bundle_inner(transport);
- for (i = 0; i < data->header.references.nr; i++) {
+ for (size_t i = 0; i < data->header.references.nr; i++) {
struct string_list_item *e = data->header.references.items + i;
const char *name = e->string;
struct ref *ref = alloc_ref(name);
static void die_with_unpushed_submodules(struct string_list *needs_pushing)
{
- int i;
-
fprintf(stderr, _("The following submodule paths contain changes that can\n"
"not be found on any remote:\n"));
- for (i = 0; i < needs_pushing->nr; i++)
+ for (size_t i = 0; i < needs_pushing->nr; i++)
fprintf(stderr, " %s\n", needs_pushing->items[i].string);
fprintf(stderr, _("\nPlease try\n\n"
" git push --recurse-submodules=on-demand\n\n"
void transport_unlock_pack(struct transport *transport, unsigned int flags)
{
int in_signal_handler = !!(flags & TRANSPORT_UNLOCK_PACK_IN_SIGNAL_HANDLER);
- int i;
- for (i = 0; i < transport->pack_lockfiles.nr; i++)
+ for (size_t i = 0; i < transport->pack_lockfiles.nr; i++)
if (in_signal_handler)
unlink(transport->pack_lockfiles.items[i].string);
else
* Copyright (C) Linus Torvalds, 2005
*/
-#define DISABLE_SIGN_COMPARE_WARNINGS
-
#include "git-compat-util.h"
#include "gettext.h"
#include "trace2.h"
static const char *fmt_with_err(char *buf, int n, const char *fmt)
{
char str_error[256], *err;
- int i, j;
+ size_t i, j;
err = strerror(errno);
for (i = j = 0; err[i] && j < sizeof(str_error) - 1; ) {
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "version.h"
#include "strbuf.h"
if (!agent) {
struct strbuf buf = STRBUF_INIT;
- int i;
strbuf_addstr(&buf, git_user_agent());
strbuf_trim(&buf);
- for (i = 0; i < buf.len; i++) {
+ for (size_t i = 0; i < buf.len; i++) {
if (buf.buf[i] <= 32 || buf.buf[i] >= 127)
buf.buf[i] = '.';
}
#define USE_THE_REPOSITORY_VARIABLE
-#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
#include "config.h"
int off,
int *diff)
{
- int i;
struct suffix_match match1 = { -1, off, -1 };
struct suffix_match match2 = { -1, off, -1 };
- for (i = 0; i < prereleases->nr; i++) {
+ for (size_t i = 0; i < prereleases->nr; i++) {
const char *suffix = prereleases->items[i].string;
int start, suffix_len = strlen(suffix);
if (suffix_len < off)