Skip to content

Commit 20fabfd

Browse files
committed
main: use unsiged int as the return type of countXtags
Signed-off-by: Masatake YAMATO <[email protected]>
1 parent 6b06565 commit 20fabfd

File tree

6 files changed

+10
-11
lines changed

6 files changed

+10
-11
lines changed

main/entry.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ static tagEntryInfoX *copyTagEntry (const tagEntryInfo *const tag,
11111111

11121112
if (slot->extraDynamic)
11131113
{
1114-
int n = countXtags () - XTAG_COUNT;
1114+
unsigned int n = countXtags () - XTAG_COUNT;
11151115
slot->extraDynamic = xCalloc ((n / 8) + 1, uint8_t);
11161116
memcpy (slot->extraDynamic, tag->extraDynamic, (n / 8) + 1);
11171117
}
@@ -2017,8 +2017,8 @@ static void markTagExtraBitFull (tagEntryInfo *const tag, xtagType extra, bool m
20172017
else
20182018
{
20192019
Assert (extra < countXtags ());
2020-
2021-
int n = countXtags () - XTAG_COUNT;
2020+
Assert (XTAG_COUNT <= countXtags ());
2021+
unsigned int n = countXtags () - XTAG_COUNT;
20222022
tag->extraDynamic = xCalloc ((n / 8) + 1, uint8_t);
20232023
if (!tag->inCorkQueue)
20242024
PARSER_TRASH_BOX(tag->extraDynamic, eFree);

main/field.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,9 +1072,9 @@ static const char *renderFieldExtras (const tagEntryInfo *const tag,
10721072
const char *value CTAGS_ATTR_UNUSED,
10731073
vString* b)
10741074
{
1075-
int i;
1075+
unsigned int i;
10761076
bool hasExtra = false;
1077-
int c = countXtags();
1077+
unsigned int c = countXtags();
10781078

10791079
for (i = 0; i < c; i++)
10801080
{
@@ -1757,7 +1757,7 @@ static EsObject* getFieldValueForExtras (const tagEntryInfo *tag, const fieldDef
17571757

17581758
EsObject* a = opt_array_new ();
17591759

1760-
for (int i = 0; i < countXtags (); i++)
1760+
for (unsigned int i = 0; i < countXtags (); i++)
17611761
{
17621762
if (!isTagExtraBitMarked (tag, i))
17631763
continue;

main/options.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1257,8 +1257,7 @@ static void processExcmdOption (
12571257

12581258
static void resetXtags (langType lang, bool mode)
12591259
{
1260-
int i;
1261-
for (i = 0; i < countXtags (); i++)
1260+
for (unsigned int i = 0; i < countXtags (); i++)
12621261
if ((lang == LANG_AUTO) || (lang == getXtagOwner (i)))
12631262
enableXtag (i, mode);
12641263
}

main/parse.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4975,7 +4975,7 @@ extern bool makeExtraDescriptionsPseudoTags (const langType language,
49754975
const ptagDesc *pdesc)
49764976
{
49774977
bool written = false;
4978-
for (int i = 0; i < countXtags (); i++)
4978+
for (unsigned int i = 0; i < countXtags (); i++)
49794979
{
49804980
if (getXtagOwner (i) == language
49814981
&& isXtagEnabled (i))

main/xtag.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ extern void initXtagObjects (void)
324324
}
325325
}
326326

327-
extern int countXtags (void)
327+
extern unsigned int countXtags (void)
328328
{
329329
return xtagObjectUsed;
330330
}

main/xtag_p.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ extern const char* getXtagName (xtagType type);
4343
extern const char* getXtagDescription (xtagType type);
4444

4545
extern void initXtagObjects (void);
46-
extern int countXtags (void);
46+
extern unsigned int countXtags (void);
4747

4848
extern int defineXtag (xtagDefinition *def, langType language);
4949
extern xtagType nextSiblingXtag (xtagType type);

0 commit comments

Comments
 (0)