FORMAT_NUL_TERMINATED,
};
-struct field {
+struct repo_info_field {
const char *key;
get_value_fn *get_value;
};
}
/* repo_info_field keys must be in lexicographical order */
-static const struct field repo_info_field[] = {
+static const struct repo_info_field repo_info_field[] = {
{ "layout.bare", get_layout_bare },
{ "layout.shallow", get_layout_shallow },
{ "object.format", get_object_format },
static int repo_info_field_cmp(const void *va, const void *vb)
{
- const struct field *a = va;
- const struct field *b = vb;
+ const struct repo_info_field *a = va;
+ const struct repo_info_field *b = vb;
return strcmp(a->key, b->key);
}
-static const struct field *get_repo_info_field(const char *key)
+static const struct repo_info_field *get_repo_info_field(const char *key)
{
- const struct field search_key = { key, NULL };
- const struct field *found = bsearch(&search_key, repo_info_field,
- ARRAY_SIZE(repo_info_field),
- sizeof(*found),
- repo_info_field_cmp);
+ const struct repo_info_field search_key = { key, NULL };
+ const struct repo_info_field *found = bsearch(&search_key,
+ repo_info_field,
+ ARRAY_SIZE(repo_info_field),
+ sizeof(*found),
+ repo_info_field_cmp);
return found;
}
for (int i = 0; i < argc; i++) {
const char *key = argv[i];
- const struct field *field = get_repo_info_field(key);
+ const struct repo_info_field *field = get_repo_info_field(key);
if (!field) {
ret = error(_("key '%s' not found"), key);
struct strbuf valbuf = STRBUF_INIT;
for (size_t i = 0; i < ARRAY_SIZE(repo_info_field); i++) {
- const struct field *field = &repo_info_field[i];
+ const struct repo_info_field *field = &repo_info_field[i];
strbuf_reset(&valbuf);
field->get_value(repo, &valbuf);
}
for (size_t i = 0; i < ARRAY_SIZE(repo_info_field); i++) {
- const struct field *field = &repo_info_field[i];
+ const struct repo_info_field *field = &repo_info_field[i];
printf("%s%c", field->key, sep);
}