From 9456c927a4fb4dca29fcbea84cb6727bf7b0bbb9 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 21 Sep 2007 16:11:48 +0300 Subject: [PATCH] Hide rpmtag index details from the api - move rpmTagGet*() out of line from rpmlib.h to tagnames.c - move headerTagIndices_s from header.h into tagnames.c --- lib/rpmlib.h | 18 +++--------------- rpmdb/header.h | 14 -------------- rpmdb/tagname.c | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 29 deletions(-) diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 0ad4579..450efa6 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -936,33 +936,21 @@ void rpmShowRpmlibProvides(FILE * fp); * @param tag tag value * @return tag name, "(unknown)" on not found */ -static inline -const char * rpmTagGetName(int tag) -{ - return ((*rpmTags->tagName)(tag)); -} +const char * rpmTagGetName(int tag); /** * Return tag data type from value. * @param tag tag value * @return tag data type, RPM_NULL_TYPE on not found. */ -static inline -int rpmTagGetType(int tag) -{ - return ((*rpmTags->tagType)(tag)); -} +int rpmTagGetType(int tag); /** * Return tag value from name. * @param tagstr name of tag * @return tag value, -1 on not found */ -static inline -int rpmTagGetValue(const char * tagstr) -{ - return ((*rpmTags->tagValue)(tagstr)); -} +int rpmTagGetValue(const char * tagstr); #define RPMLEAD_BINARY 0 #define RPMLEAD_SOURCE 1 diff --git a/rpmdb/header.h b/rpmdb/header.h index 9cf9e8d..e6bc548 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 8366a8b..06d1afd 100644 --- a/rpmdb/tagname.c +++ b/rpmdb/tagname.c @@ -8,6 +8,20 @@ #include #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)); +} + -- 2.7.4