summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-01-28 13:17:17 +0200
committerPanu Matilainen <pmatilai@redhat.com>2009-01-28 13:17:17 +0200
commit216eb1c7e02b4bfb9a1d301538b41533db489b55 (patch)
tree027ebe1bc32460ba456f7440989f6262da668b71 /lib
parentfe846402a45dc1ceadf3a7538071b40b0fd70a60 (diff)
downloadlibrpm-tizen-216eb1c7e02b4bfb9a1d301538b41533db489b55.tar.gz
librpm-tizen-216eb1c7e02b4bfb9a1d301538b41533db489b55.tar.bz2
librpm-tizen-216eb1c7e02b4bfb9a1d301538b41533db489b55.zip
Add API for getting the class of tag type directly
- no point requiring going through rpmTagGetType() if we already have the type at hand, and in some nutty cases (wrt extensions) these dont even always match - rpmTagGetClass() is now just a convenience wrapper around rpmTagTypeGetClass()
Diffstat (limited to 'lib')
-rw-r--r--lib/rpmtag.h7
-rw-r--r--lib/tagname.c9
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/rpmtag.h b/lib/rpmtag.h
index 335d413da..dd64c2d85 100644
--- a/lib/rpmtag.h
+++ b/lib/rpmtag.h
@@ -398,6 +398,13 @@ rpmTagClass rpmTagGetClass(rpmTag tag);
rpmTag rpmTagGetValue(const char * tagstr);
/** \ingroup rpmtag
+ * Return data class of type
+ * @param tag tag type
+ * @return data class, RPM_NULL_CLASS on unknown.
+ */
+rpmTagClass rpmTagTypeGetClass(rpmTagType type);
+
+/** \ingroup rpmtag
* Return known rpm tag names, sorted by name.
* @retval tagnames tag container of string array type
* @param fullname return short or full name
diff --git a/lib/tagname.c b/lib/tagname.c
index a81424dfa..cdc5ad657 100644
--- a/lib/tagname.c
+++ b/lib/tagname.c
@@ -294,10 +294,10 @@ rpmTagType rpmTagGetType(rpmTag tag)
return ((*rpmTags->tagType)(tag));
}
-rpmTagClass rpmTagGetClass(rpmTag tag)
+rpmTagClass rpmTagTypeGetClass(rpmTagType type)
{
rpmTagClass class;
- switch (rpmTagGetType(tag) & RPM_MASK_TYPE) {
+ switch (type & RPM_MASK_TYPE) {
case RPM_CHAR_TYPE:
case RPM_INT8_TYPE:
case RPM_INT16_TYPE:
@@ -321,6 +321,11 @@ rpmTagClass rpmTagGetClass(rpmTag tag)
return class;
}
+rpmTagClass rpmTagGetClass(rpmTag tag)
+{
+ return rpmTagTypeGetClass(rpmTagGetType(tag));
+}
+
rpmTag rpmTagGetValue(const char * tagstr)
{
return ((*rpmTags->tagValue)(tagstr));