This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

commit 8f3f34cf26325a4cd9e0f3f53aaa113632ff9077
Author: Guillem Jover <[email protected]>
Date:   Fri Feb 13 04:36:19 2015 +0100

    dpkg-query: Use pkg_array_foreach() instead of ad-hoc traversal
---
 src/querycmd.c | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/src/querycmd.c b/src/querycmd.c
index 7cd84ed..02c9f3b 100644
--- a/src/querycmd.c
+++ b/src/querycmd.c
@@ -222,8 +222,9 @@ Desired=Unknown/Install/Remove/Purge/Hold\n\
 }
 
 static void
-list1package(struct pkginfo *pkg, struct list_format *fmt, struct pkg_array 
*array)
+pkg_array_list_item(struct pkg_array *array, struct pkginfo *pkg, void 
*pkg_data)
 {
+  struct list_format *fmt = pkg_data;
   int l;
   const char *pdesc;
 
@@ -243,21 +244,6 @@ list1package(struct pkginfo *pkg, struct list_format *fmt, 
struct pkg_array *arr
                     pdesc, l);
 }
 
-static void
-list_found_packages(struct list_format *fmt, struct pkg_array *array)
-{
-  int i;
-
-  for (i = 0; i < array->n_pkgs; i++) {
-    struct pkginfo *pkg = array->pkgs[i];
-
-    if (pkg == NULL)
-      continue;
-
-    list1package(pkg, fmt, array);
-  }
-}
-
 static int
 listpackages(const char *const *argv)
 {
@@ -284,7 +270,7 @@ listpackages(const char *const *argv)
         array.pkgs[i] = NULL;
     }
 
-    list_found_packages(&fmt, &array);
+    pkg_array_foreach(&array, pkg_array_list_item, &fmt);
   } else {
     int argc, ip, *found;
     struct pkg_spec *ps;
@@ -310,7 +296,7 @@ listpackages(const char *const *argv)
         array.pkgs[i] = NULL;
     }
 
-    list_found_packages(&fmt, &array);
+    pkg_array_foreach(&array, pkg_array_list_item, &fmt);
 
     /* FIXME: we might get non-matching messages for sub-patterns specified
      * after their super-patterns, due to us skipping on first match. */

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/dpkg/dpkg.git


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

Reply via email to