ref-filter: introduce enum atom_type
authorZheNing Hu <adlternative@gmail.com>
Thu, 13 May 2021 15:15:38 +0000 (15:15 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 13 May 2021 21:37:28 +0000 (06:37 +0900)
commit1197f1a46360d3ae96bd9c15908a3a6f8e562207
treed321b6425908518ad24a50274ba29ef124b003a4
parent0caf20f22806dfd478ab3ac26b5f3682f383d3b4
ref-filter: introduce enum atom_type

In the original ref-filter design, it will copy the parsed
atom's name and attributes to `used_atom[i].name` in the
atom's parsing step, and use it again for string matching
in the later specific ref attributes filling step. It use
a lot of string matching to determine which atom we need.

Introduce the enum "atom_type", each enum value is named
as `ATOM_*`, which is the index of each corresponding
valid_atom entry. In the first step of the atom parsing,
`used_atom.atom_type` will record corresponding enum value
from valid_atom entry index, and then in specific reference
attribute filling step, only need to compare the value of
the `used_atom[i].atom_type` to check the atom type.

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Christian Couder <christian.couder@gmail.com>
Signed-off-by: ZheNing Hu <adlternative@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ref-filter.c