diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-02-22 19:24:01 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-02-22 19:24:01 +0000 |
commit | 22471f298ab4b6a88b3b7516bd229608dccaf89f (patch) | |
tree | f0d5aa06a26f9d25ccf2dba78e4055c918f5a0e0 | |
parent | ede192c8b89e1b29aa8dda16687573c651a2d92f (diff) | |
download | perl-URPM-22471f298ab4b6a88b3b7516bd229608dccaf89f.tar perl-URPM-22471f298ab4b6a88b3b7516bd229608dccaf89f.tar.gz perl-URPM-22471f298ab4b6a88b3b7516bd229608dccaf89f.tar.bz2 perl-URPM-22471f298ab4b6a88b3b7516bd229608dccaf89f.tar.xz perl-URPM-22471f298ab4b6a88b3b7516bd229608dccaf89f.zip |
(parse_rpm,verify_rpm) factorize some tests
-rw-r--r-- | URPM.xs | 46 |
1 files changed, 21 insertions, 25 deletions
@@ -3469,28 +3469,23 @@ Urpm_parse_rpm(urpm, filename, ...) keep_all_tags = SvTRUE(ST(i+1)); else if (len == 8 && !memcmp(s, "callback", 8) && SvROK(ST(i+1))) callback = ST(i+1); - else if (len == 5) { - if (!memcmp(s, "nopgp", 5)) { - if (SvIV(ST(i+1))) vsflags |= (RPMVSF_NOSHA1 | RPMVSF_NOSHA1HEADER); - } - else if (!memcmp(s, "nogpg", 5)) { - if (SvIV(ST(i+1))) vsflags |= (RPMVSF_NOSHA1 | RPMVSF_NOSHA1HEADER); - } - else if (!memcmp(s, "nomd5", 5)) { - if (SvIV(ST(i+1))) vsflags |= (RPMVSF_NOMD5 | RPMVSF_NOMD5HEADER); - } - else if (!memcmp(s, "norsa", 5)) { - if (SvIV(ST(i+1))) vsflags |= (RPMVSF_NORSA | RPMVSF_NORSAHEADER); - } - else if (!memcmp(s, "nodsa", 5)) { - if (SvIV(ST(i+1))) vsflags |= (RPMVSF_NODSA | RPMVSF_NODSAHEADER); - } + else if (SvIV(ST(i+1))) { + if (len == 5) { + if (!memcmp(s, "nopgp", 5)) + vsflags |= (RPMVSF_NOSHA1 | RPMVSF_NOSHA1HEADER); + else if (!memcmp(s, "nogpg", 5)) + vsflags |= (RPMVSF_NOSHA1 | RPMVSF_NOSHA1HEADER); + else if (!memcmp(s, "nomd5", 5)) + vsflags |= (RPMVSF_NOMD5 | RPMVSF_NOMD5HEADER); + else if (!memcmp(s, "norsa", 5)) + vsflags |= (RPMVSF_NORSA | RPMVSF_NORSAHEADER); + else if (!memcmp(s, "nodsa", 5)) + vsflags |= (RPMVSF_NODSA | RPMVSF_NODSAHEADER); } else if (len == 9) { - if (!memcmp(s, "nodigests", 9)) { - if (SvIV(ST(i+1))) vsflags |= _RPMVSF_NODIGESTS; - } else - if (!memcmp(s, "nopayload", 9)) { - if (SvIV(ST(i+1))) vsflags |= _RPMVSF_NOPAYLOAD; + if (!memcmp(s, "nodigests", 9)) + vsflags |= _RPMVSF_NODIGESTS; + else if (!memcmp(s, "nopayload", 9)) + vsflags |= _RPMVSF_NOPAYLOAD; } } } @@ -3536,10 +3531,11 @@ Urpm_verify_rpm(filename, ...) for (i = 1 ; i < items - 1 ; i += 2) { STRLEN len; char *s = SvPV(ST(i), len); - if (len == 9 && !strncmp(s, "nodigests", 9)) { - if (SvIV(ST(i+1))) qva.qva_flags &= ~VERIFY_DIGEST; - } else if (len == 12 && !strncmp(s, "nosignatures", 12)) { - if (SvIV(ST(i+1))) qva.qva_flags &= ~VERIFY_SIGNATURE; + if (SvIV(ST(i+1))) { + if (len == 9 && !strncmp(s, "nodigests", 9)) + qva.qva_flags &= ~VERIFY_DIGEST; + else if (len == 12 && !strncmp(s, "nosignatures", 12)) + qva.qva_flags &= ~VERIFY_SIGNATURE; } } fd = Fopen(filename, "r"); |