diff options
author | Per Øyvind Karlsen <peroyvind@mandriva.org> | 2010-11-19 22:07:57 +0000 |
---|---|---|
committer | Per Øyvind Karlsen <peroyvind@mandriva.org> | 2010-11-19 22:07:57 +0000 |
commit | cd1316f150358879210c6fcbcf7a41c428a0890a (patch) | |
tree | 2170927cc2c7395d1d1c93936ab567b50c566808 | |
parent | 8701cb376c57565cb183ab8b11fe6569e7982d21 (diff) | |
download | perl-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.xs | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -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++ = ']'; } } |