mirror of
https://git.proxmox.com/git/libgit2
synced 2025-06-19 18:54:04 +00:00
examples: general: narrow down scope of loop variables
This commit is contained in:
parent
8572e2252b
commit
5aa101078e
@ -644,10 +644,7 @@ static void index_walking(git_repository *repo)
|
|||||||
static void reference_listing(git_repository *repo)
|
static void reference_listing(git_repository *repo)
|
||||||
{
|
{
|
||||||
git_strarray ref_list;
|
git_strarray ref_list;
|
||||||
const char *refname;
|
|
||||||
git_reference *ref;
|
|
||||||
unsigned i;
|
unsigned i;
|
||||||
char oid_hex[GIT_OID_HEXSZ+1];
|
|
||||||
|
|
||||||
printf("\n*Reference Listing*\n");
|
printf("\n*Reference Listing*\n");
|
||||||
|
|
||||||
@ -662,7 +659,10 @@ static void reference_listing(git_repository *repo)
|
|||||||
git_reference_list(&ref_list, repo);
|
git_reference_list(&ref_list, repo);
|
||||||
|
|
||||||
for (i = 0; i < ref_list.count; ++i) {
|
for (i = 0; i < ref_list.count; ++i) {
|
||||||
memset(oid_hex, 0, sizeof(oid_hex));
|
git_reference *ref;
|
||||||
|
char oid_hex[GIT_OID_HEXSZ+1] = GIT_OID_HEX_ZERO;
|
||||||
|
const char *refname;
|
||||||
|
|
||||||
refname = ref_list.strings[i];
|
refname = ref_list.strings[i];
|
||||||
git_reference_lookup(&ref, repo, refname);
|
git_reference_lookup(&ref, repo, refname);
|
||||||
|
|
||||||
@ -679,6 +679,8 @@ static void reference_listing(git_repository *repo)
|
|||||||
fprintf(stderr, "Unexpected reference type\n");
|
fprintf(stderr, "Unexpected reference type\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
git_reference_free(ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
git_strarray_free(&ref_list);
|
git_strarray_free(&ref_list);
|
||||||
|
Loading…
Reference in New Issue
Block a user