diff options
Diffstat (limited to 'rpmdb')
-rw-r--r-- | rpmdb/header.h | 14 | ||||
-rw-r--r-- | rpmdb/tagname.c | 40 |
2 files changed, 40 insertions, 14 deletions
diff --git a/rpmdb/header.h b/rpmdb/header.h index 9cf9e8dcf..e6bc54896 100644 --- a/rpmdb/header.h +++ b/rpmdb/header.h @@ -132,20 +132,6 @@ struct headerTagTableEntry_s { /** */ typedef struct headerTagIndices_s * headerTagIndices; -struct headerTagIndices_s { - int (*loadIndex) (headerTagTableEntry ** ipp, int * np, - int (*cmp) (const void * avp, const void * bvp)); - /*!< load sorted tag index. */ - headerTagTableEntry * byName; /*!< header tags sorted by name. */ - int byNameSize; /*!< no. of entries. */ - int (*byNameCmp) (const void * avp, const void * bvp); /*!< compare entries by name. */ - int (*tagValue) (const char * name); /* return value from name. */ - headerTagTableEntry * byValue; /*!< header tags sorted by value. */ - int byValueSize; /*!< no. of entries. */ - int (*byValueCmp) (const void * avp, const void * bvp); /*!< compare entries by value. */ - const char * (*tagName) (int value); /* Return name from value. */ - int (*tagType) (int value); /* Return type from value. */ -}; /** \ingroup header */ diff --git a/rpmdb/tagname.c b/rpmdb/tagname.c index 8366a8bd0..06d1afdc0 100644 --- a/rpmdb/tagname.c +++ b/rpmdb/tagname.c @@ -8,6 +8,20 @@ #include <rpmio.h> #include "debug.h" +struct headerTagIndices_s { + int (*loadIndex) (headerTagTableEntry ** ipp, int * np, + int (*cmp) (const void * avp, const void * bvp)); + /*!< load sorted tag index. */ + headerTagTableEntry * byName; /*!< header tags sorted by name. */ + int byNameSize; /*!< no. of entries. */ + int (*byNameCmp) (const void * avp, const void * bvp); /*!< compare entries by name. */ + int (*tagValue) (const char * name); /* return value from name. */ + headerTagTableEntry * byValue; /*!< header tags sorted by value. */ + int byValueSize; /*!< no. of entries. */ + int (*byValueCmp) (const void * avp, const void * bvp); /*!< compare entries by value. */ + const char * (*tagName) (int value); /* Return name from value. */ + int (*tagType) (int value); /* Return type from value. */ +}; /** * Compare tag table entries by name. @@ -254,3 +268,29 @@ static int _tagValue(const char * tagstr) } return -1; } + +const char * rpmTagGetName(int tag) +{ + return ((*rpmTags->tagName)(tag)); +} + +/** + * Return tag data type from value. + * @param tag tag value + * @return tag data type, RPM_NULL_TYPE on not found. + */ +int rpmTagGetType(int tag) +{ + return ((*rpmTags->tagType)(tag)); +} + +/** + * Return tag value from name. + * @param tagstr name of tag + * @return tag value, -1 on not found + */ +int rpmTagGetValue(const char * tagstr) +{ + return ((*rpmTags->tagValue)(tagstr)); +} + |