aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <peroyvind@mandriva.org>2010-11-19 22:07:57 +0000
committerPer Øyvind Karlsen <peroyvind@mandriva.org>2010-11-19 22:07:57 +0000
commitcd1316f150358879210c6fcbcf7a41c428a0890a (patch)
tree2170927cc2c7395d1d1c93936ab567b50c566808
parent8701cb376c57565cb183ab8b11fe6569e7982d21 (diff)
downloadperl-URPM-cd1316f150358879210c6fcbcf7a41c428a0890a.tar
perl-URPM-cd1316f150358879210c6fcbcf7a41c428a0890a.tar.gz
perl-URPM-cd1316f150358879210c6fcbcf7a41c428a0890a.tar.bz2
perl-URPM-cd1316f150358879210c6fcbcf7a41c428a0890a.tar.xz
perl-URPM-cd1316f150358879210c6fcbcf7a41c428a0890a.zip
make print_list_entry() a bit nicer with rpmsenseFlags parsing tip from jbj
-rw-r--r--URPM.xs9
1 files changed, 3 insertions, 6 deletions
diff --git a/URPM.xs b/URPM.xs
index 4adf115..cc07e14 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -329,13 +329,10 @@ print_list_entry(char *buff, int sz, const char *name, rpmsenseFlags flags, cons
len = strlen(evr);
if (len > 0) {
if (p - buff + 6 + len >= sz) return -1;
+ static const char *Fstr[] = { "?0","<",">","?3","==","<=",">=","?7" };
+ uint32_t Fx = ((flags >> 1) & 0x7);
*p++ = '[';
- if (flags & RPMSENSE_LESS) *p++ = '<';
- if (flags & RPMSENSE_GREATER) *p++ = '>';
- if (flags & RPMSENSE_EQUAL) *p++ = '=';
- if ((flags & (RPMSENSE_LESS|RPMSENSE_EQUAL|RPMSENSE_GREATER)) == RPMSENSE_EQUAL) *p++ = '=';
- *p++ = ' ';
- memcpy(p, evr, len); p+= len;
+ p = stpcpy( stpcpy( stpcpy(p, Fstr[Fx]), " "), evr);
*p++ = ']';
}
}