bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] fts: make the code compile with -DFTS_DEBUG


From: Kamil Dudka
Subject: [PATCH 2/2] fts: make the code compile with -DFTS_DEBUG
Date: Wed, 21 Mar 2018 15:44:22 +0100

---
 lib/fts.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lib/fts.c b/lib/fts.c
index 4195f6170..7983320b7 100644
--- a/lib/fts.c
+++ b/lib/fts.c
@@ -253,8 +253,11 @@ static int      fts_safe_changedir (FTS *, FTSENT *, int, 
const char *)
 # include <inttypes.h>
 # include <stdint.h>
 # include <stdio.h>
+# include <error.h>
 bool fts_debug = false;
 # define Dprintf(x) do { if (fts_debug) printf x; } while (false)
+static void fd_ring_print (FTS const *sp, FILE *stream, char const *msg);
+static void fd_ring_check (FTS const *sp);
 #else
 # define Dprintf(x)
 # define fd_ring_check(x)
@@ -1732,16 +1735,18 @@ static void
 fd_ring_print (FTS const *sp, FILE *stream, char const *msg)
 {
   I_ring const *fd_ring = &sp->fts_fd_ring;
-  unsigned int i = fd_ring->fts_front;
+  unsigned int i = fd_ring->ir_front;
+  if (!fts_debug)
+    return;
   fprintf (stream, "=== %s ========== %d\n", msg, sp->fts_cwd_fd);
   if (i_ring_empty (fd_ring))
     return;
 
   while (true)
     {
-      int fd = fd_ring->fts_fd_ring[i];
+      int fd = fd_ring->ir_data[i];
       fprintf (stream, "%d: %d:\n", i, fd);
-      if (i == fd_ring->fts_back)
+      if (i == fd_ring->ir_back)
         break;
       i = (i + I_RING_SIZE - 1) % I_RING_SIZE;
     }
-- 
2.14.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]