Quellcode durchsuchen

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.
Guillem Jover vor 16 Jahren
Ursprung
Commit
f45885e714
4 geänderte Dateien mit 7 neuen und 6 gelöschten Zeilen
  1. 4 3
      lib/dpkg/pkg-show.c
  2. 1 1
      lib/dpkg/pkg-show.h
  3. 1 1
      src/enquiry.c
  4. 1 1
      src/query.c

+ 4 - 3
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;
 }
 

+ 1 - 1
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
 

+ 1 - 1
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);

+ 1 - 1
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,