diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2007-07-16 13:21:41 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2007-07-16 13:21:41 +0300 |
commit | d406964cb1018403ab50337d02fd78b9bbd9052d (patch) | |
tree | 57f135255d25dbf2abd5ae81dab20b0082dc1e4a /python/header-py.c | |
parent | 89b63475e2ea89f671c3e55aafc6010af3d402b4 (diff) | |
download | librpm-tizen-d406964cb1018403ab50337d02fd78b9bbd9052d.tar.gz librpm-tizen-d406964cb1018403ab50337d02fd78b9bbd9052d.tar.bz2 librpm-tizen-d406964cb1018403ab50337d02fd78b9bbd9052d.zip |
Use tagType() for determining header data types (array or not etc)
Diffstat (limited to 'python/header-py.c')
-rw-r--r-- | python/header-py.c | 46 |
1 files changed, 6 insertions, 40 deletions
diff --git a/python/header-py.c b/python/header-py.c index dcfd98af5..7c67181a5 100644 --- a/python/header-py.c +++ b/python/header-py.c @@ -392,7 +392,7 @@ long tagNumFromPyObject (PyObject *item) static PyObject * hdr_subscript(hdrObject * s, PyObject * item) /*@*/ { - int type, count, i, tag = -1; + int tagtype, type, count, i, tag = -1; void * data; PyObject * o, * metao; char ** stringArray; @@ -446,45 +446,10 @@ static PyObject * hdr_subscript(hdrObject * s, PyObject * item) } } - switch (tag) { - case RPMTAG_OLDFILENAMES: - case RPMTAG_FILESIZES: - case RPMTAG_FILESTATES: - case RPMTAG_FILEMODES: - case RPMTAG_FILEUIDS: - case RPMTAG_FILEGIDS: - case RPMTAG_FILERDEVS: - case RPMTAG_FILEMTIMES: - case RPMTAG_FILEMD5S: - case RPMTAG_FILELINKTOS: - case RPMTAG_FILEFLAGS: - case RPMTAG_ROOT: - case RPMTAG_FILEUSERNAME: - case RPMTAG_FILEGROUPNAME: - case RPMTAG_REQUIRENAME: - case RPMTAG_REQUIREFLAGS: - case RPMTAG_REQUIREVERSION: - case RPMTAG_PROVIDENAME: - case RPMTAG_PROVIDEFLAGS: - case RPMTAG_PROVIDEVERSION: - case RPMTAG_OBSOLETENAME: - case RPMTAG_OBSOLETEFLAGS: - case RPMTAG_OBSOLETEVERSION: - case RPMTAG_CONFLICTNAME: - case RPMTAG_CONFLICTFLAGS: - case RPMTAG_CONFLICTVERSION: - case RPMTAG_CHANGELOGTIME: - case RPMTAG_FILEVERIFYFLAGS: - forceArray = 1; - break; - case RPMTAG_SUMMARY: - case RPMTAG_GROUP: - case RPMTAG_DESCRIPTION: - freeData = 1; - break; - default: - break; - } + tagtype = tagType(tag); + type = tagtype & RPM_MASK_TYPE; + forceArray = (tagtype & RPM_MASK_RETURN_TYPE) == RPM_ARRAY_RETURN_TYPE; + freeData = (tagtype & RPM_MASK_TYPE) == RPM_I18NSTRING_TYPE; switch (type) { case RPM_BIN_TYPE: @@ -548,6 +513,7 @@ static PyObject * hdr_subscript(hdrObject * s, PyObject * item) break; case RPM_STRING_TYPE: + case RPM_I18NSTRING_TYPE: if (count != 1 || forceArray) { stringArray = data; |