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

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=4166eac9d16aaf0bd8a6ef94dd289134529408b1

commit 4166eac9d16aaf0bd8a6ef94dd289134529408b1
Author: Guillem Jover <[email protected]>
AuthorDate: Mon Nov 6 23:48:02 2023 +0100

    dpkg-split: Change heading print logic to use a proper boolean
    
    Do not use a char * to track if we've already printed the heading
    nor if we have found a part file.
    
    Changelog: internal
---
 src/split/queue.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/split/queue.c b/src/split/queue.c
index b8d559b94..0a7ba8b49 100644
--- a/src/split/queue.c
+++ b/src/split/queue.c
@@ -252,19 +252,22 @@ do_queue(const char *const *argv)
 {
   struct partqueue *queue;
   struct partqueue *pq;
-  const char *head;
   struct stat stab;
   off_t bytes;
+  bool part_found;
 
   if (*argv)
     badusage(_("--%s takes no arguments"), cipaction->olong);
 
   queue = scandepot();
 
-  head= N_("Junk files left around in the depot directory:\n");
+  part_found = false;
   for (pq= queue; pq; pq= pq->nextinqueue) {
     if (pq->info.md5sum) continue;
-    fputs(gettext(head),stdout); head= "";
+    if (!part_found) {
+      printf(_("Junk files left around in the depot directory:\n"));
+      part_found = true;
+    }
     if (lstat(pq->info.filename,&stab))
       ohshit(_("unable to stat '%.250s'"), pq->info.filename);
     if (S_ISREG(stab.st_mode)) {
@@ -274,16 +277,21 @@ do_queue(const char *const *argv)
       printf(_(" %s (not a plain file)\n"),pq->info.filename);
     }
   }
-  if (!*head) putchar('\n');
+  if (part_found)
+    putchar('\n');
 
-  head= N_("Packages not yet reassembled:\n");
+  part_found = false;
   for (pq= queue; pq; pq= pq->nextinqueue) {
     struct partinfo ti;
     int i;
 
     if (!pq->info.md5sum) continue;
     mustgetpartinfo(pq->info.filename,&ti);
-    fputs(gettext(head),stdout); head= "";
+    if (!part_found) {
+      printf(_("Packages not yet reassembled:\n"));
+      part_found = false;
+    }
+
     printf(_(" Package %s: part(s) "), ti.package);
     bytes= 0;
     for (i=0; i<ti.maxpartn; i++) {

-- 
Dpkg.Org's dpkg

Reply via email to