The following commit has been merged in the master branch:
commit f85913b03e016de54edefd03f692be4b207dd679
Author: Guillem Jover <[EMAIL PROTECTED]>
Date:   Sat Jul 26 07:52:42 2008 +0300

    Move duplicate limiteddescription functions to src/pkg-show.c

diff --git a/ChangeLog b/ChangeLog
index 220b3f8..b5b423e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2008-07-26  Guillem Jover  <[EMAIL PROTECTED]>
 
+       * src/Makefile.am (dpkg_SOURCES): Add 'pkg-show.c'.
+       (dpkg_query_SOURCES): Likewise.
+       * src/main.h (limiteddescription): New function prototype.
+       * src/enquiry.c (limiteddescription): Move function to ...
+       * src/pkg-show.c: ... here. New file.
+       * src/query.c (limiteddescription): Remove duplicate function.
+
+2008-07-26  Guillem Jover  <[EMAIL PROTECTED]>
+
        * lib/showpkg.c (parseformat): Do not set cur->type to field, as
        that's set in parsefield.
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 1ad8378..3588cd7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -22,6 +22,7 @@ dpkg_SOURCES = \
        main.c main.h \
        packages.c \
        pkg-list.c \
+       pkg-show.c \
        processarc.c \
        remove.c \
        select.c \
@@ -40,6 +41,7 @@ dpkg_query_SOURCES = \
        errors.c \
        filesdb.c filesdb.h \
        pkg-list.c \
+       pkg-show.c \
        query.c
 
 dpkg_query_LDADD = \
diff --git a/src/enquiry.c b/src/enquiry.c
index 49a1660..dbc3198 100644
--- a/src/enquiry.c
+++ b/src/enquiry.c
@@ -42,19 +42,6 @@
 #include "filesdb.h"
 #include "main.h"
 
-static void limiteddescription(struct pkginfo *pkg, int maxl,
-                               const char **pdesc_r, int *l_r) {
-  const char *pdesc, *p;
-  int l;
-  
-  pdesc = pkg->installed.valid ? pkg->installed.description : NULL;
-  if (!pdesc) pdesc= _("(no description available)");
-  p= strchr(pdesc,'\n');
-  if (!p) p= pdesc+strlen(pdesc);
-  l = min(p - pdesc, maxl);
-  *pdesc_r=pdesc; *l_r=l;
-}
-
 struct badstatinfo {
   int (*yesno)(struct pkginfo*, const struct badstatinfo *bsi);
   int val;
diff --git a/src/main.h b/src/main.h
index ec79908..52ea592 100644
--- a/src/main.h
+++ b/src/main.h
@@ -141,6 +141,9 @@ void cmpversions(const char *const *argv) NONRETURNING;
  */
 int pkglistqsortcmp(const void *a, const void *b);
 
+void limiteddescription(struct pkginfo *pkg,
+                        int maxl, const char **pdesc_r, int *l_r);
+
 /* from select.c */
 
 void getselections(const char *const *argv);
diff --git a/src/pkg-list.c b/src/pkg-show.c
similarity index 67%
copy from src/pkg-list.c
copy to src/pkg-show.c
index c29fa07..aa22eb3 100644
--- a/src/pkg-list.c
+++ b/src/pkg-show.c
@@ -1,6 +1,6 @@
 /*
  * dpkg - main program for package management
- * pkg-list.c - primitives for pkg list handling
+ * pkg-show.c - primitives for pkg information display
  *
  * Copyright © 1995,1996 Ian Jackson <[EMAIL PROTECTED]>
  *
@@ -27,12 +27,21 @@
 #include <dpkg-db.h>
 #include <dpkg-priv.h>
 
-int
-pkglistqsortcmp(const void *a, const void *b)
+void
+limiteddescription(struct pkginfo *pkg,
+                   int maxl, const char **pdesc_r, int *l_r)
 {
-       const struct pkginfo *pa = *(const struct pkginfo **)a;
-       const struct pkginfo *pb = *(const struct pkginfo **)b;
+       const char *pdesc, *p;
+       int l;
 
-       return strcmp(pa->name, pb->name);
+       pdesc = pkg->installed.valid ? pkg->installed.description : NULL;
+       if (!pdesc)
+               pdesc = _("(no description available)");
+       p = strchr(pdesc, '\n');
+       if (!p)
+               p = pdesc + strlen(pdesc);
+       l = min(p - pdesc, maxl);
+       *pdesc_r = pdesc;
+       *l_r = l;
 }
 
diff --git a/src/query.c b/src/query.c
index 9fae3ce..ab42572 100644
--- a/src/query.c
+++ b/src/query.c
@@ -46,19 +46,6 @@
 
 static const char* showformat          = "${Package}\t${Version}\n";
 
-static void limiteddescription(struct pkginfo *pkg, int maxl,
-                               const char **pdesc_r, int *l_r) {
-  const char *pdesc, *p;
-  int l;
-  
-  pdesc = pkg->installed.valid ? pkg->installed.description : NULL;
-  if (!pdesc) pdesc= _("(no description available)");
-  p= strchr(pdesc,'\n');
-  if (!p) p= pdesc+strlen(pdesc);
-  l = min(p - pdesc, maxl);
-  *pdesc_r=pdesc; *l_r=l;
-}
-
 static int getwidth(void) {
   int fd;
   int res;

-- 
dpkg's main repository


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

Reply via email to