Skip to content

Commit

Permalink
main: consider dynamically allocated xtags when iterating all xtags d…
Browse files Browse the repository at this point in the history
…efintions

A for loop was used for the iteration.

The original code used XTAG_COUNT as the limit of the loop counter.
However, the contestant doesn't consider dynamically allocated parser-specific
xtags.

The new code uses countXtags() that considers dynamically allocated
parser-specific xtags.

Signed-off-by: Masatake YAMATO <[email protected]>
  • Loading branch information
masatake committed May 16, 2021
1 parent cf6b3bb commit d619a4c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Tmain/getter-extras-field.d/stderr-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ true
[/reference]
true
[/qualified /reference]
false
true
[/X.foo]
true
[/reference /X.foo]
2 changes: 1 addition & 1 deletion main/entry.c
Original file line number Diff line number Diff line change
Expand Up @@ -1935,7 +1935,7 @@ extern bool isTagExtraBitMarked (const tagEntryInfo *const tag, xtagType extra)

extern bool isTagExtra (const tagEntryInfo *const tag)
{
for (unsigned int i = 0; i < XTAG_COUNT; i++)
for (unsigned int i = 0; i < countXtags(); i++)
if (isTagExtraBitMarked (tag, i))
return true;
return false;
Expand Down

0 comments on commit d619a4c

Please sign in to comment.