summaryrefslogtreecommitdiff
path: root/lib/rpmtd.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-09-21 12:40:33 +0300
committerPanu Matilainen <pmatilai@redhat.com>2010-09-21 12:40:33 +0300
commitbe488096e0f011a42d4dd46fa7c3769054158383 (patch)
tree4818066b0d426e02c3381069d9961471b4be803e /lib/rpmtd.c
parentbf4a383892acc8a5bb6bbf45e87ac96674a3ecd1 (diff)
downloadlibrpm-tizen-be488096e0f011a42d4dd46fa7c3769054158383.tar.gz
librpm-tizen-be488096e0f011a42d4dd46fa7c3769054158383.tar.bz2
librpm-tizen-be488096e0f011a42d4dd46fa7c3769054158383.zip
Use the new tag type/return type getters everywhere
- Instead of masking and bitfiddling all over the place, use the new getters to get the exact (enum) type directly. rpmTagGetType() is now unused within rpm but leaving around for backwards compatibility
Diffstat (limited to 'lib/rpmtd.c')
-rw-r--r--lib/rpmtd.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/rpmtd.c b/lib/rpmtd.c
index 0d023a230..eaeec451b 100644
--- a/lib/rpmtd.c
+++ b/lib/rpmtd.c
@@ -264,7 +264,7 @@ char *rpmtdFormat(rpmtd td, rpmtdFormats fmt, const char *errmsg)
int rpmtdSetTag(rpmtd td, rpmTag tag)
{
assert(td != NULL);
- rpmTagType newtype = rpmTagGetType(tag);
+ rpmTagType newtype = rpmTagGetTagType(tag);
int rc = 0;
/*
@@ -276,13 +276,13 @@ int rpmtdSetTag(rpmtd td, rpmTag tag)
goto exit;
if (td->data || td->count > 0) {
- if (rpmTagGetType(td->tag) != rpmTagGetType(tag)) {
+ if (rpmTagGetTagType(td->tag) != rpmTagGetTagType(tag)) {
goto exit;
}
}
td->tag = tag;
- td->type = newtype & RPM_MASK_TYPE;
+ td->type = newtype;
rc = 1;
exit:
@@ -307,8 +307,8 @@ static inline int rpmtdSet(rpmtd td, rpmTag tag, rpmTagType type,
int rpmtdFromUint8(rpmtd td, rpmTag tag, uint8_t *data, rpm_count_t count)
{
- rpmTagType type = rpmTagGetType(tag) & RPM_MASK_TYPE;
- rpmTagReturnType retype = rpmTagGetType(tag) & RPM_MASK_RETURN_TYPE;
+ rpmTagType type = rpmTagGetTagType(tag);
+ rpmTagReturnType retype = rpmTagGetReturnType(tag);
if (count < 1)
return 0;
@@ -334,8 +334,8 @@ int rpmtdFromUint8(rpmtd td, rpmTag tag, uint8_t *data, rpm_count_t count)
int rpmtdFromUint16(rpmtd td, rpmTag tag, uint16_t *data, rpm_count_t count)
{
- rpmTagType type = rpmTagGetType(tag) & RPM_MASK_TYPE;
- rpmTagReturnType retype = rpmTagGetType(tag) & RPM_MASK_RETURN_TYPE;
+ rpmTagType type = rpmTagGetTagType(tag);
+ rpmTagReturnType retype = rpmTagGetReturnType(tag);
if (type != RPM_INT16_TYPE || count < 1)
return 0;
if (retype != RPM_ARRAY_RETURN_TYPE && count > 1)
@@ -346,8 +346,8 @@ int rpmtdFromUint16(rpmtd td, rpmTag tag, uint16_t *data, rpm_count_t count)
int rpmtdFromUint32(rpmtd td, rpmTag tag, uint32_t *data, rpm_count_t count)
{
- rpmTagType type = rpmTagGetType(tag) & RPM_MASK_TYPE;
- rpmTagReturnType retype = rpmTagGetType(tag) & RPM_MASK_RETURN_TYPE;
+ rpmTagType type = rpmTagGetTagType(tag);
+ rpmTagReturnType retype = rpmTagGetReturnType(tag);
if (type != RPM_INT32_TYPE || count < 1)
return 0;
if (retype != RPM_ARRAY_RETURN_TYPE && count > 1)
@@ -358,8 +358,8 @@ int rpmtdFromUint32(rpmtd td, rpmTag tag, uint32_t *data, rpm_count_t count)
int rpmtdFromUint64(rpmtd td, rpmTag tag, uint64_t *data, rpm_count_t count)
{
- rpmTagType type = rpmTagGetType(tag) & RPM_MASK_TYPE;
- rpmTagReturnType retype = rpmTagGetType(tag) & RPM_MASK_RETURN_TYPE;
+ rpmTagType type = rpmTagGetTagType(tag);
+ rpmTagReturnType retype = rpmTagGetReturnType(tag);
if (type != RPM_INT64_TYPE || count < 1)
return 0;
if (retype != RPM_ARRAY_RETURN_TYPE && count > 1)
@@ -370,7 +370,7 @@ int rpmtdFromUint64(rpmtd td, rpmTag tag, uint64_t *data, rpm_count_t count)
int rpmtdFromString(rpmtd td, rpmTag tag, const char *data)
{
- rpmTagType type = rpmTagGetType(tag) & RPM_MASK_TYPE;
+ rpmTagType type = rpmTagGetTagType(tag);
int rc = 0;
if (type == RPM_STRING_TYPE) {
@@ -384,7 +384,7 @@ int rpmtdFromString(rpmtd td, rpmTag tag, const char *data)
int rpmtdFromStringArray(rpmtd td, rpmTag tag, const char **data, rpm_count_t count)
{
- rpmTagType type = rpmTagGetType(tag) & RPM_MASK_TYPE;
+ rpmTagType type = rpmTagGetTagType(tag);
if (type != RPM_STRING_ARRAY_TYPE || count < 1)
return 0;
if (type == RPM_STRING_TYPE && count != 1)
@@ -396,7 +396,7 @@ int rpmtdFromStringArray(rpmtd td, rpmTag tag, const char **data, rpm_count_t co
int rpmtdFromArgv(rpmtd td, rpmTag tag, ARGV_t argv)
{
int count = argvCount(argv);
- rpmTagType type = rpmTagGetType(tag) & RPM_MASK_TYPE;
+ rpmTagType type = rpmTagGetTagType(tag);
if (type != RPM_STRING_ARRAY_TYPE || count < 1)
return 0;
@@ -407,8 +407,8 @@ int rpmtdFromArgv(rpmtd td, rpmTag tag, ARGV_t argv)
int rpmtdFromArgi(rpmtd td, rpmTag tag, ARGI_t argi)
{
int count = argiCount(argi);
- rpmTagType type = rpmTagGetType(tag) & RPM_MASK_TYPE;
- rpmTagReturnType retype = rpmTagGetType(tag) & RPM_MASK_RETURN_TYPE;
+ rpmTagType type = rpmTagGetTagType(tag);
+ rpmTagReturnType retype = rpmTagGetReturnType(tag);
if (type != RPM_INT32_TYPE || retype != RPM_ARRAY_RETURN_TYPE || count < 1)
return 0;