The following commit has been merged in the master branch:
commit f45885e71425f23a707250a87e0672ec96d82cf7
Author: Guillem Jover <[email protected]>
Date:   Fri Jul 16 16:28:39 2010 +0200

    libdpkg: Make pkg_summary() return the summary instead of void
    
    Change from returning through a pointer argument to returning it from
    the function return value.

diff --git a/lib/dpkg/pkg-show.c b/lib/dpkg/pkg-show.c
index d36d9bf..7101153 100644
--- a/lib/dpkg/pkg-show.c
+++ b/lib/dpkg/pkg-show.c
@@ -29,8 +29,8 @@
 #include <dpkg/dpkg-db.h>
 #include <dpkg/pkg-show.h>
 
-void
-pkg_summary(struct pkginfo *pkg, const char **pdesc_r, int *len_ret)
+const char *
+pkg_summary(struct pkginfo *pkg, int *len_ret)
 {
        const char *pdesc;
        size_t len;
@@ -44,6 +44,7 @@ pkg_summary(struct pkginfo *pkg, const char **pdesc_r, int 
*len_ret)
                len = strlen(pdesc);
 
        *len_ret = len;
-       *pdesc_r = pdesc;
+
+       return pdesc;
 }
 
diff --git a/lib/dpkg/pkg-show.h b/lib/dpkg/pkg-show.h
index 120df80..4d56091 100644
--- a/lib/dpkg/pkg-show.h
+++ b/lib/dpkg/pkg-show.h
@@ -26,7 +26,7 @@
 
 DPKG_BEGIN_DECLS
 
-void pkg_summary(struct pkginfo *pkg, const char **pdesc_ret, int *len_ret);
+const char *pkg_summary(struct pkginfo *pkg, int *len_ret);
 
 DPKG_END_DECLS
 
diff --git a/src/enquiry.c b/src/enquiry.c
index a30b3eb..1f46b22 100644
--- a/src/enquiry.c
+++ b/src/enquiry.c
@@ -120,7 +120,7 @@ static void describebriefly(struct pkginfo *pkg) {
   l= strlen(pkg->name);
   if (l>20) maxl -= (l-20);
 
-  pkg_summary(pkg, &pdesc, &l);
+  pdesc = pkg_summary(pkg, &l);
   l = min(l, maxl);
 
   printf(" %-20s %.*s\n",pkg->name,l,pdesc);
diff --git a/src/query.c b/src/query.c
index 2ccdf1e..0607935 100644
--- a/src/query.c
+++ b/src/query.c
@@ -125,7 +125,7 @@ Desired=Unknown/Install/Remove/Purge/Hold\n\
     *head = true;
   }
 
-  pkg_summary(pkg, &pdesc, &l);
+  pdesc = pkg_summary(pkg, &l);
   l = min(l, dw);
 
   printf(format,

-- 
dpkg's main repository


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

Reply via email to