Skip to content

Commit

Permalink
Merge pull request #3724 from masatake/misc-fix
Browse files Browse the repository at this point in the history
Misc fix
  • Loading branch information
masatake committed May 14, 2023
2 parents da101ad + b9d073b commit ee10ac3
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 16 deletions.
8 changes: 4 additions & 4 deletions main/field.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ static fieldObject* getFieldObject(fieldType type)
return fieldObjects + type;
}

extern fieldType getFieldTypeForOption (char letter)
extern fieldType getFieldTypeForLetter (char letter)
{
unsigned int i;

Expand Down Expand Up @@ -1249,7 +1249,7 @@ extern bool enableField (fieldType type, bool state)
else
verbose ("enable field \"%s\"<%s>: %s\n",
getFieldObject(type)->def->name,
getLanguageName (getFieldOwner(type)),
getLanguageName (getFieldLanguage(type)),
(state? "yes": "no"));
return old;
}
Expand All @@ -1259,7 +1259,7 @@ extern bool isCommonField (fieldType type)
return (FIELD_BUILTIN_LAST < type)? false: true;
}

extern int getFieldOwner (fieldType type)
extern langType getFieldLanguage (fieldType type)
{
return getFieldObject(type)->language;
}
Expand Down Expand Up @@ -1763,7 +1763,7 @@ static EsObject* getFieldValueForExtras (const tagEntryInfo *tag, const fieldDef
if (!isTagExtraBitMarked (tag, i))
continue;

langType lang = getXtagOwner (i);
langType lang = getXtagLanguage (i);
const char *lang_name = (lang == LANG_IGNORE)
? NULL
: getLanguageName (lang);
Expand Down
1 change: 0 additions & 1 deletion main/field.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ typedef const char* (*fieldRenderer)(const tagEntryInfo *const,
const char *,
vString *);

#define FIELD_LETTER_NO_USE '\0'
struct sFieldDefinition {
/* letter, and ftype are initialized in the main part,
not in a parser. */
Expand Down
7 changes: 5 additions & 2 deletions main/field_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* FUNCTION PROTOTYPES
*/

extern fieldType getFieldTypeForOption (char letter);
extern fieldType getFieldTypeForLetter (char letter);

/*
`getFieldTypeForName' is for looking for a field not owned by any parser,
Expand All @@ -46,7 +46,10 @@ extern fieldType getFieldTypeForName (const char *name);
extern fieldType getFieldTypeForNameAndLanguage (const char *fieldName, langType language);
extern bool enableField (fieldType type, bool state);
extern bool isCommonField (fieldType type);
extern int getFieldOwner (fieldType type);

/* Return LANG_IGNORE if the field is a common field.*/
extern langType getFieldLanguage (fieldType type);

extern const char* getFieldDescription (fieldType type);
extern const char* getFieldName (fieldType type);
extern unsigned char getFieldLetter (fieldType type);
Expand Down
2 changes: 1 addition & 1 deletion main/fmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ static fmtElement** queueTagField (fmtElement **last, long width, bool truncatio
else
{
language = LANG_IGNORE;
ftype = getFieldTypeForOption (field_letter);
ftype = getFieldTypeForLetter (field_letter);
}

if (ftype == FIELD_UNKNOWN)
Expand Down
2 changes: 1 addition & 1 deletion main/lregex.c
Original file line number Diff line number Diff line change
Expand Up @@ -3981,7 +3981,7 @@ static EsObject *lrop_markextra (OptVM *vm, EsObject *name)
if (xt == XTAG_UNKNOWN)
return OPTSCRIPT_ERR_UNKNOWNEXTRA;

langType lang = getXtagOwner (xt);
langType lang = getXtagLanguage (xt);
if (lang != LANG_IGNORE && e->langType != lang)
{
error (WARNING,
Expand Down
6 changes: 3 additions & 3 deletions main/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -1258,7 +1258,7 @@ static void processExcmdOption (
static void resetXtags (langType lang, bool mode)
{
for (unsigned int i = 0; i < countXtags (); i++)
if ((lang == LANG_AUTO) || (lang == getXtagOwner (i)))
if ((lang == LANG_AUTO) || (lang == getXtagLanguage (i)))
enableXtag (i, mode);
}

Expand Down Expand Up @@ -1346,7 +1346,7 @@ static void processExtraTagsOption (
static void resetFieldsOption (langType lang, bool mode)
{
for (unsigned int i = 0; i < countFields (); ++i)
if ((lang == LANG_AUTO) || (lang == getFieldOwner (i)))
if ((lang == LANG_AUTO) || (lang == getFieldLanguage (i)))
enableField (i, mode);

if ((lang == LANG_AUTO || lang == LANG_IGNORE)&& !mode)
Expand Down Expand Up @@ -1419,7 +1419,7 @@ static void processFieldsOption (
vStringPut (longName, c);
else
{
t = getFieldTypeForOption (c);
t = getFieldTypeForLetter (c);
if (t == FIELD_UNKNOWN)
error(WARNING, "Unsupported parameter '%c' for \"%s\" option",
c, option);
Expand Down
4 changes: 2 additions & 2 deletions main/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -4947,7 +4947,7 @@ extern bool makeFieldDescriptionsPseudoTags (const langType language,
bool written = false;
for (unsigned int i = 0; i < countFields (); i++)
{
if (getFieldOwner (i) == language
if (getFieldLanguage (i) == language
&& isFieldEnabled (i))
{
if (makeFieldDescriptionPseudoTag (language, i, pdesc))
Expand Down Expand Up @@ -4977,7 +4977,7 @@ extern bool makeExtraDescriptionsPseudoTags (const langType language,
bool written = false;
for (unsigned int i = 0; i < countXtags (); i++)
{
if (getXtagOwner (i) == language
if (getXtagLanguage (i) == language
&& isXtagEnabled (i))
{
if (makeExtraDescriptionPseudoTag (language, i, pdesc))
Expand Down
2 changes: 1 addition & 1 deletion main/xtag.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ extern bool isCommonXtag (xtagType type)
return (type < XTAG_COUNT)? true: false;
}

extern langType getXtagOwner (xtagType type)
extern langType getXtagLanguage (xtagType type)
{
return getXtagObject (type)->language;
}
Expand Down
2 changes: 1 addition & 1 deletion main/xtag_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extern bool isXtagFixed (xtagType type);
extern bool isCommonXtag (xtagType type);

/* Return LANG_IGNORE for common fields. */
extern langType getXtagOwner (xtagType type);
extern langType getXtagLanguage (xtagType type);

extern const char* getXtagName (xtagType type);
extern const char* getXtagDescription (xtagType type);
Expand Down

0 comments on commit ee10ac3

Please sign in to comment.