Skip to content

Commit 339e962

Browse files
lucasoshirogitster
authored andcommitted
repo: rename struct field to repo_info_field
Change the name of the struct field to repo_info_field, making it explicit that it is an internal data type of git-repo-info. Signed-off-by: Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent ddb3231 commit 339e962

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

builtin/repo.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ enum output_format {
3131
FORMAT_NUL_TERMINATED,
3232
};
3333

34-
struct field {
34+
struct repo_info_field {
3535
const char *key;
3636
get_value_fn *get_value;
3737
};
@@ -63,7 +63,7 @@ static int get_references_format(struct repository *repo, struct strbuf *buf)
6363
}
6464

6565
/* repo_info_field keys must be in lexicographical order */
66-
static const struct field repo_info_field[] = {
66+
static const struct repo_info_field repo_info_field[] = {
6767
{ "layout.bare", get_layout_bare },
6868
{ "layout.shallow", get_layout_shallow },
6969
{ "object.format", get_object_format },
@@ -72,19 +72,20 @@ static const struct field repo_info_field[] = {
7272

7373
static int repo_info_field_cmp(const void *va, const void *vb)
7474
{
75-
const struct field *a = va;
76-
const struct field *b = vb;
75+
const struct repo_info_field *a = va;
76+
const struct repo_info_field *b = vb;
7777

7878
return strcmp(a->key, b->key);
7979
}
8080

81-
static const struct field *get_repo_info_field(const char *key)
81+
static const struct repo_info_field *get_repo_info_field(const char *key)
8282
{
83-
const struct field search_key = { key, NULL };
84-
const struct field *found = bsearch(&search_key, repo_info_field,
85-
ARRAY_SIZE(repo_info_field),
86-
sizeof(*found),
87-
repo_info_field_cmp);
83+
const struct repo_info_field search_key = { key, NULL };
84+
const struct repo_info_field *found = bsearch(&search_key,
85+
repo_info_field,
86+
ARRAY_SIZE(repo_info_field),
87+
sizeof(*found),
88+
repo_info_field_cmp);
8889

8990
return found;
9091
}
@@ -115,7 +116,7 @@ static int print_fields(int argc, const char **argv,
115116

116117
for (int i = 0; i < argc; i++) {
117118
const char *key = argv[i];
118-
const struct field *field = get_repo_info_field(key);
119+
const struct repo_info_field *field = get_repo_info_field(key);
119120

120121
if (!field) {
121122
ret = error(_("key '%s' not found"), key);
@@ -137,7 +138,7 @@ static int print_all_fields(struct repository *repo,
137138
struct strbuf valbuf = STRBUF_INIT;
138139

139140
for (size_t i = 0; i < ARRAY_SIZE(repo_info_field); i++) {
140-
const struct field *field = &repo_info_field[i];
141+
const struct repo_info_field *field = &repo_info_field[i];
141142

142143
strbuf_reset(&valbuf);
143144
field->get_value(repo, &valbuf);
@@ -164,7 +165,7 @@ static int print_keys(enum output_format format)
164165
}
165166

166167
for (size_t i = 0; i < ARRAY_SIZE(repo_info_field); i++) {
167-
const struct field *field = &repo_info_field[i];
168+
const struct repo_info_field *field = &repo_info_field[i];
168169
printf("%s%c", field->key, sep);
169170
}
170171

0 commit comments

Comments
 (0)