The following commit has been merged in the master branch:
commit b9ca9a28b0218eee981bc51a289e45634560c230
Author: Guillem Jover <[email protected]>
Date:   Thu Dec 22 05:21:39 2011 +0100

    libdpkg: Refactor pkg status to abbreviations mapping into new functions

diff --git a/lib/dpkg/pkg-show.c b/lib/dpkg/pkg-show.c
index 4a75ea8..a8a3b81 100644
--- a/lib/dpkg/pkg-show.c
+++ b/lib/dpkg/pkg-show.c
@@ -3,7 +3,7 @@
  * pkg-show.c - primitives for pkg information display
  *
  * Copyright © 1995,1996 Ian Jackson <[email protected]>
- * Copyright © 2008-2010 Guillem Jover <[email protected]>
+ * Copyright © 2008-2011 Guillem Jover <[email protected]>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -47,3 +47,21 @@ pkg_summary(const struct pkginfo *pkg, int *len_ret)
 
        return pdesc;
 }
+
+int
+pkg_abbrev_want(const struct pkginfo *pkg)
+{
+       return "uihrp"[pkg->want];
+}
+
+int
+pkg_abbrev_status(const struct pkginfo *pkg)
+{
+       return "ncHUFWti"[pkg->status];
+}
+
+int
+pkg_abbrev_eflag(const struct pkginfo *pkg)
+{
+       return " R"[pkg->eflag];
+}
diff --git a/lib/dpkg/pkg-show.h b/lib/dpkg/pkg-show.h
index 1f29b6e..980ff5d 100644
--- a/lib/dpkg/pkg-show.h
+++ b/lib/dpkg/pkg-show.h
@@ -2,7 +2,7 @@
  * libdpkg - Debian packaging suite library routines
  * pkg-show.h - primitives for pkg information display
  *
- * Copyright © 2010 Guillem Jover <[email protected]>
+ * Copyright © 2010-2011 Guillem Jover <[email protected]>
  *
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -27,6 +27,9 @@
 DPKG_BEGIN_DECLS
 
 const char *pkg_summary(const struct pkginfo *pkg, int *len_ret);
+int pkg_abbrev_want(const struct pkginfo *pkg);
+int pkg_abbrev_status(const struct pkginfo *pkg);
+int pkg_abbrev_eflag(const struct pkginfo *pkg);
 
 DPKG_END_DECLS
 
diff --git a/src/querycmd.c b/src/querycmd.c
index 5086017..bb9552a 100644
--- a/src/querycmd.c
+++ b/src/querycmd.c
@@ -187,9 +187,9 @@ list1package(struct pkginfo *pkg, struct list_format *fmt, 
struct pkg_array *arr
   l = min(l, fmt->dw);
 
   printf(fmt->format,
-         "uihrp"[pkg->want],
-         "ncHUFWti"[pkg->status],
-         " R"[pkg->eflag],
+         pkg_abbrev_want(pkg),
+         pkg_abbrev_status(pkg),
+         pkg_abbrev_eflag(pkg),
          pkg->set->name,
          versiondescribe(&pkg->installed.version, vdew_nonambig),
          l, pdesc);

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to