aboutsummaryrefslogtreecommitdiffstats
path: root/URPM.xs
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2002-06-13 10:24:18 +0000
committerFrancois Pons <fpons@mandriva.com>2002-06-13 10:24:18 +0000
commite198d9c84f1f2c7e92aafc525fe7413773cfb817 (patch)
tree30bbface6bb27c8d313d7f867052d836828f3bbc /URPM.xs
parent8fc236e1a35221fbf8c6e43e1744cc1f232bf3ff (diff)
downloadperl-URPM-e198d9c84f1f2c7e92aafc525fe7413773cfb817.tar
perl-URPM-e198d9c84f1f2c7e92aafc525fe7413773cfb817.tar.gz
perl-URPM-e198d9c84f1f2c7e92aafc525fe7413773cfb817.tar.bz2
perl-URPM-e198d9c84f1f2c7e92aafc525fe7413773cfb817.tar.xz
perl-URPM-e198d9c84f1f2c7e92aafc525fe7413773cfb817.zip
0.04-1mdk
Diffstat (limited to 'URPM.xs')
-rw-r--r--URPM.xs71
1 files changed, 33 insertions, 38 deletions
diff --git a/URPM.xs b/URPM.xs
index 3d238ab..a8bdbe2 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -1453,49 +1453,44 @@ Urpm_ranges_overlap(a, b)
PREINIT:
char *sa = a, *sb = b;
int aflags = 0, bflags = 0;
- char *eona, *eonb;
- char *eosa, *eosb;
- char save_a, save_b;
CODE:
- while (*sa && *sa != ' ' && *sa != '[') ++sa; save_a = *sa; *(eona = sa++) = 0;
- while (*sb && *sb != ' ' && *sb != '[') ++sb; save_b = *sb; *(eonb = sb++) = 0;
- if (save_a)
+ while (*sa && *sa != ' ' && *sa != '[' && *sa != '<' && *sa != '>' && *sa != '=' && *sa == *sb) {
+ ++sa;
+ ++sb;
+ }
+ if (*sa && *sa != ' ' && *sa != '[' && *sa != '<' && *sa != '>' && *sa != '=') {
+ /* the strings are sure to be different */
+ RETVAL = 0;
+ } else {
while (*sa) {
- switch (*sa++) {
- case '<': aflags |= RPMSENSE_LESS; break;
- case '>': aflags |= RPMSENSE_GREATER; break;
- case '=': aflags |= RPMSENSE_EQUAL; break;
- case ' ':
- case '[':
- case '*':
- case ']':
- break;
- default: goto exit_a;
- }
+ if (*sa == ' ' || *sa == '[' || *sa == '*' || *sa == ']');
+ else if (*sa == '<') aflags |= RPMSENSE_LESS;
+ else if (*sa == '>') aflags |= RPMSENSE_GREATER;
+ else if (*sa == '=') aflags |= RPMSENSE_EQUAL;
+ else break;
+ ++sa;
}
-exit_a:
- if (save_b)
while (*sb) {
- switch (*sb++) {
- case '<': bflags |= RPMSENSE_LESS; break;
- case '>': bflags |= RPMSENSE_GREATER; break;
- case '=': bflags |= RPMSENSE_EQUAL; break;
- case ' ':
- case '[':
- case '*':
- case ']':
- break;
- default: goto exit_b;
- }
+ if (*sb == ' ' || *sb == '[' || *sb == '*' || *sb == ']');
+ else if (*sb == '<') bflags |= RPMSENSE_LESS;
+ else if (*sb == '>') bflags |= RPMSENSE_GREATER;
+ else if (*sb == '=') bflags |= RPMSENSE_EQUAL;
+ else break;
+ ++sb;
+ }
+ if (!aflags || !bflags)
+ RETVAL = 1; /* really faster to test it there instead of later */
+ else {
+ char *eosa = strchr(sa, ']');
+ char *eosb = strchr(sb, ']');
+
+ if (eosa) *eosa = 0;
+ if (eosb) *eosb = 0;
+ RETVAL = rpmRangesOverlap("", sa, aflags, "", sb, bflags);
+ if (eosb) *eosb = ']';
+ if (eosa) *eosa = ']';
}
-exit_b:
- if ((eosa = strchr(--sa, ']')) != NULL) *eosa = 0;
- if ((eosb = strchr(--sb, ']')) != NULL) *eosb = 0;
- RETVAL = rpmRangesOverlap(a, sa, aflags, b, sb, bflags);
- if (eosb) *eosb = ']';
- if (eosa) *eosa = ']';
- *eonb = save_b;
- *eona = save_a;
+ }
OUTPUT:
RETVAL