URI: 
       Don't keep all snapshots in memory during walk - dedup - deduplicating backup program
  HTML git clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/
   DIR Log
   DIR Files
   DIR Refs
   DIR Tags
   DIR README
   DIR LICENSE
       ---
   DIR commit f450209a3a8f19f21652cb32dd4ff1ce1efdd8fd
   DIR parent 9af5dd1c8a0f4ed051b7247ca759263f5cfee054
  HTML Author: sin <sin@2f30.org>
       Date:   Thu, 21 Feb 2019 18:24:52 +0000
       
       Don't keep all snapshots in memory during walk
       
       Diffstat:
         M dedup.c                             |      11 +++++++----
       
       1 file changed, 7 insertions(+), 4 deletions(-)
       ---
   DIR diff --git a/dedup.c b/dedup.c
       @@ -574,12 +574,14 @@ rebuild_cache(struct snapshot *snap, void *arg)
        void
        walk(int (*fn)(struct snapshot *, void *), void *arg)
        {
       -        struct snapshot *snap;
                uint64_t i;
        
       -        snap = alloc_snap();
                xlseek(ifd, sizeof(snaphdr), SEEK_SET);
                for (i = 0; i < snaphdr.nr_snapshots; i++) {
       +                struct snapshot *snap;
       +                int ret;
       +
       +                snap = alloc_snap();
                        if (xread(ifd, snap, sizeof(*snap)) == 0)
                                errx(1, "read: unexpected EOF");
        
       @@ -588,10 +590,11 @@ walk(int (*fn)(struct snapshot *, void *), void *arg)
                                  snap->nr_blk_descs * sizeof(snap->blk_desc[0])) == 0)
                                errx(1, "read: unexpected EOF");
        
       -                if ((*fn)(snap, arg) == WALK_STOP)
       +                ret = (*fn)(snap, arg);
       +                free(snap);
       +                if (ret == WALK_STOP)
                                break;
                }
       -        free_snap(snap);
        }
        
        void