From 8bbe233e474ef694baececdb7ce4c6d10377be89 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Sat, 15 Nov 2003 19:44:39 +0000 Subject: fixed indentation and reworked code to be simpler --- URPM.xs | 168 ++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 83 insertions(+), 85 deletions(-) (limited to 'URPM.xs') diff --git a/URPM.xs b/URPM.xs index de32a27..60f5549 100644 --- a/URPM.xs +++ b/URPM.xs @@ -667,107 +667,105 @@ return_list_tag_modifier(Header header, int_32 tag_name) { char *s= buff; switch (tag_name) { case RPMTAG_FILEFLAGS: - if (list[i] & RPMFILE_CONFIG) *s++ = 'c'; - if (list[i] & RPMFILE_DOC) *s++ = 'd'; - if (list[i] & RPMFILE_GHOST) *s++ = 'g'; - if (list[i] & RPMFILE_LICENSE) *s++ = 'l'; - if (list[i] & RPMFILE_ICON) *s++ = 'i'; - if (list[i] & RPMFILE_MISSINGOK) *s++ = 'm'; - if (list[i] & RPMFILE_NOREPLACE) *s++ = 'n'; - if (list[i] & RPMFILE_SPECFILE) *s++ = 'S'; - if (list[i] & RPMFILE_README) *s++ = 'R'; - if (list[i] & RPMFILE_EXCLUDE) *s++ = 'e'; - if (list[i] & RPMFILE_UNPATCHED) *s++ = 'u'; - if (list[i] & RPMFILE_PUBKEY) *s++ = 'p'; - + if (list[i] & RPMFILE_CONFIG) *s++ = 'c'; + if (list[i] & RPMFILE_DOC) *s++ = 'd'; + if (list[i] & RPMFILE_GHOST) *s++ = 'g'; + if (list[i] & RPMFILE_LICENSE) *s++ = 'l'; + if (list[i] & RPMFILE_ICON) *s++ = 'i'; + if (list[i] & RPMFILE_MISSINGOK) *s++ = 'm'; + if (list[i] & RPMFILE_NOREPLACE) *s++ = 'n'; + if (list[i] & RPMFILE_SPECFILE) *s++ = 'S'; + if (list[i] & RPMFILE_README) *s++ = 'R'; + if (list[i] & RPMFILE_EXCLUDE) *s++ = 'e'; + if (list[i] & RPMFILE_UNPATCHED) *s++ = 'u'; + if (list[i] & RPMFILE_PUBKEY) *s++ = 'p'; break; default: return; } *s = '\0'; XPUSHs(sv_2mortal(newSVpv(buff, strlen(buff)))); - } + } PUTBACK; } void return_list_tag(Header header, int_32 tag_name) { - dSP; - if (header) { - int_32 *list = NULL; - uint_16 *list16; - 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; + dSP; + if (header) { + int_32 *list = NULL; + uint_16 *list16; + 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_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) { - 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]))); - 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) { + 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]))); + break; /* - case RPM_INT64_TYPE: - break; + case RPM_INT64_TYPE: + break; */ - case RPM_STRING_TYPE: - XPUSHs(sv_2mortal(newSVpv((char *) list[i], strlen((char *) list[i])))); - break; - case RPM_BIN_TYPE: - break; - case RPM_STRING_ARRAY_TYPE: - XPUSHs(sv_2mortal(newSVpv((char *) list[i],strlen((char *) list[i])))); - break; - case RPM_I18NSTRING_TYPE: - break; - } - } - } + case RPM_STRING_TYPE: + XPUSHs(sv_2mortal(newSVpv((char *) list[i], strlen((char *) list[i])))); + break; + case RPM_BIN_TYPE: + break; + case RPM_STRING_ARRAY_TYPE: + XPUSHs(sv_2mortal(newSVpv((char *) list[i],strlen((char *) list[i])))); + break; + case RPM_I18NSTRING_TYPE: + break; + } + } } - } - PUTBACK; + } + } + PUTBACK; } -- cgit v1.2.1