summaryrefslogtreecommitdiff
path: root/rpmdb
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2007-09-21 16:11:48 +0300
committerPanu Matilainen <pmatilai@redhat.com>2007-09-21 16:11:48 +0300
commit9456c927a4fb4dca29fcbea84cb6727bf7b0bbb9 (patch)
tree46d60325ec029d36e09ef771a545dfe39f79ccbf /rpmdb
parent3a26a31576ea482c6c6e06b6cc685c2e57d47177 (diff)
downloadrpm-9456c927a4fb4dca29fcbea84cb6727bf7b0bbb9.tar.gz
rpm-9456c927a4fb4dca29fcbea84cb6727bf7b0bbb9.tar.bz2
rpm-9456c927a4fb4dca29fcbea84cb6727bf7b0bbb9.zip
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
Diffstat (limited to 'rpmdb')
-rw-r--r--rpmdb/header.h14
-rw-r--r--rpmdb/tagname.c40
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));
+}
+