aboutsummaryrefslogtreecommitdiffstats
path: root/URPM.xs
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-06-13 18:43:23 +0000
committerThierry Vignaud <tv@mageia.org>2012-06-13 18:43:23 +0000
commit1df7674620bf127c65c330261b84217cc280c51c (patch)
tree61e18ca0b1276cef40234d5f992e81cde8712dcb /URPM.xs
parent68b559332ac7dfdfd192d7e4a65c40ba80586865 (diff)
downloadperl-URPM-1df7674620bf127c65c330261b84217cc280c51c.tar
perl-URPM-1df7674620bf127c65c330261b84217cc280c51c.tar.gz
perl-URPM-1df7674620bf127c65c330261b84217cc280c51c.tar.bz2
perl-URPM-1df7674620bf127c65c330261b84217cc280c51c.tar.xz
perl-URPM-1df7674620bf127c65c330261b84217cc280c51c.zip
(provides_overlap) alias it with obsoletes_overlap
(saves another 1.1% of code size)
Diffstat (limited to 'URPM.xs')
-rw-r--r--URPM.xs55
1 files changed, 16 insertions, 39 deletions
diff --git a/URPM.xs b/URPM.xs
index 6c3917c..518d773 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -1954,11 +1954,26 @@ Pkg_obsoletes_overlap(pkg, s, b_nopromote=1, direction=-1)
char *s
int b_nopromote
int direction
+ ALIAS:
+ provides_overlap = 1
PREINIT:
struct cb_overlap_s os;
char *eon = NULL;
char eonc = '\0';
+ int32_t tag_name, tag_flags, tag_version;
CODE:
+ switch (ix) {
+ case 1:
+ tag_name = RPMTAG_PROVIDENAME;
+ tag_flags = RPMTAG_PROVIDEFLAGS;
+ tag_version = RPMTAG_PROVIDEVERSION;
+ break;
+ default:
+ tag_name = RPMTAG_OBSOLETENAME;
+ tag_flags = RPMTAG_OBSOLETEFLAGS;
+ tag_version = RPMTAG_OBSOLETEVERSION;
+ break;
+ }
os.name = s;
os.flags = 0;
while (*s && *s != ' ' && *s != '[' && *s != '<' && *s != '>' && *s != '=') ++s;
@@ -1980,7 +1995,7 @@ Pkg_obsoletes_overlap(pkg, s, b_nopromote=1, direction=-1)
/* mark end of name */
if (eon) { eonc = *eon; *eon = 0; }
/* return_list_str returns a negative value is the callback has returned non-zero */
- RETVAL = return_list_str(pkg->obsoletes, pkg->h, RPMTAG_OBSOLETENAME, RPMTAG_OBSOLETEFLAGS, RPMTAG_OBSOLETEVERSION,
+ RETVAL = return_list_str(ix == 0 ? pkg->obsoletes : pkg->provides, pkg->h, tag_name, tag_flags, tag_version,
callback_list_str_overlap, &os) < 0;
/* restore end of name */
if (eon) *eon = eonc;
@@ -2021,44 +2036,6 @@ Pkg_provides_nosense(pkg)
return_list_str(pkg->provides, pkg->h, RPMTAG_PROVIDENAME, 0, 0, callback_list_str_xpush, NULL);
SPAGAIN;
-int
-Pkg_provides_overlap(pkg, s, b_nopromote=1, direction=1)
- URPM::Package pkg
- char *s
- int b_nopromote
- int direction
- PREINIT:
- struct cb_overlap_s os;
- char *eon = NULL;
- char eonc = '\0';
- CODE:
- os.name = s;
- os.flags = 0;
- while (*s && *s != ' ' && *s != '[' && *s != '<' && *s != '>' && *s != '=') ++s;
- if (*s) {
- eon = s;
- while (*s) {
- if (*s == ' ' || *s == '[' || *s == '*' || *s == ']');
- else if (*s == '<') os.flags |= RPMSENSE_LESS;
- else if (*s == '>') os.flags |= RPMSENSE_GREATER;
- else if (*s == '=') os.flags |= RPMSENSE_EQUAL;
- else break;
- ++s;
- }
- os.evr = s;
- } else
- os.evr = "";
- os.direction = direction;
- os.b_nopromote = b_nopromote;
- /* mark end of name */
- if (eon) { eonc = *eon; *eon = 0; }
- /* return_list_str returns a negative value is the callback has returned non-zero */
- RETVAL = return_list_str(pkg->provides, pkg->h, RPMTAG_PROVIDENAME, RPMTAG_PROVIDEFLAGS, RPMTAG_PROVIDEVERSION,
- callback_list_str_overlap, &os) < 0;
- /* restore end of name */
- if (eon) *eon = eonc;
- OUTPUT:
- RETVAL
void
Pkg_buildarchs(pkg)