diff options
author | Olivier Thauvin <nanardon@mandriva.org> | 2004-04-21 13:13:43 +0000 |
---|---|---|
committer | Olivier Thauvin <nanardon@mandriva.org> | 2004-04-21 13:13:43 +0000 |
commit | be514d45aa490b99c0483a00ce02b41621a42aaf (patch) | |
tree | 7d95a3d7e3d2179501a55ecb2c39beaf6291054f /URPM.xs | |
parent | a1aa75d585d82aa9823a81408e4dc79f470d7069 (diff) | |
download | perl-URPM-be514d45aa490b99c0483a00ce02b41621a42aaf.tar perl-URPM-be514d45aa490b99c0483a00ce02b41621a42aaf.tar.gz perl-URPM-be514d45aa490b99c0483a00ce02b41621a42aaf.tar.bz2 perl-URPM-be514d45aa490b99c0483a00ce02b41621a42aaf.tar.xz perl-URPM-be514d45aa490b99c0483a00ce02b41621a42aaf.zip |
- cleaning return_list_tag
Diffstat (limited to 'URPM.xs')
-rw-r--r-- | URPM.xs | 68 |
1 files changed, 21 insertions, 47 deletions
@@ -695,76 +695,50 @@ void return_list_tag(Header header, int_32 tag_name) { dSP; if (header) { - int_32 *list = NULL; - uint_16 *list16; + void *list = NULL; int_32 count, type; headerGetEntry(header, tag_name, &type, (void **) &list, &count); if (list) { - if (count == 1 ) { - switch (type) { - case RPM_NULL_TYPE: - break; - case RPM_CHAR_TYPE: - XPUSHs(sv_2mortal(newSVpv((char *) list,strlen((char *) list)))); - break; - case RPM_INT8_TYPE: - break; - case RPM_INT16_TYPE: - list16 = list; - XPUSHs(sv_2mortal(newSViv(list16))); - break; - case RPM_INT32_TYPE: - XPUSHs(sv_2mortal(newSViv((int_32 *) list))); - break; -/* - case RPM_INT64_TYPE: - break; -*/ - case RPM_STRING_TYPE: - XPUSHs(sv_2mortal(newSVpv((char *) list, strlen((char *) list)))); - break; - case RPM_BIN_TYPE: - break; - case RPM_STRING_ARRAY_TYPE: - break; - case RPM_I18NSTRING_TYPE: - break; - } - } else { - int i; - for (i=0; i< count; i++) { - switch (type) { + + switch (type) { case RPM_NULL_TYPE: break; case RPM_CHAR_TYPE: - XPUSHs(sv_2mortal(newSVpv((char *) list,strlen((char *) list)))); - break; case RPM_INT8_TYPE: - break; case RPM_INT16_TYPE: - list16 = list; - XPUSHs(sv_2mortal(newSViv(list16[i]))); - break; case RPM_INT32_TYPE: - XPUSHs(sv_2mortal(newSViv((int_32 *) list[i]))); + { + int i; + int *r; + r = (int *)list; + for (i=0; i < count; i++) { + XPUSHs(sv_2mortal(newSViv(r[i]))); + } + } break; /* case RPM_INT64_TYPE: break; */ case RPM_STRING_TYPE: - XPUSHs(sv_2mortal(newSVpv((char *) list[i], strlen((char *) list[i])))); + XPUSHs(sv_2mortal(newSVpv((char *) list, 0))); break; case RPM_BIN_TYPE: break; case RPM_STRING_ARRAY_TYPE: - XPUSHs(sv_2mortal(newSVpv((char *) list[i],strlen((char *) list[i])))); + { + int i; + char **s; + + s = (char **)list; + for (i = 0; i < count; i++) { + XPUSHs(sv_2mortal(newSVpv(s[i], 0))); + } + } break; case RPM_I18NSTRING_TYPE: break; } - } - } } } PUTBACK; |