Hi!
Ah, thanks for the patch! At the time I prepared an alternative, which
I queued in a branch, but then I forgot to mention this on the list,
and to merge it. :/
Attached is what I had, which I've polished a bit more now. Will
include in my next push.
Thanks,
Guillem
From defc49ccbf2e626155e77ba77a141fa9033473a0 Mon Sep 17 00:00:00 2001
From: Guillem Jover <
[email protected]>
Date: Sun, 17 Mar 2024 15:02:45 +0100
Subject: [PATCH] libdpkg: Factor out filesystem database file loading into new
function
This code is duplicated on several places that load filesystem
databases, refactor it into a new function that takes care of the
(re)loading.
Based-on-patch-by: Simon Richter <
[email protected]>
---
lib/dpkg/Makefile.am | 1 +
lib/dpkg/db-fsys-divert.c | 63 ++++++-------------------
lib/dpkg/db-fsys-load.c | 91 +++++++++++++++++++++++++++++++++++++
lib/dpkg/db-fsys-override.c | 69 +++++++---------------------
lib/dpkg/db-fsys.h | 26 +++++++++++
5 files changed, 149 insertions(+), 101 deletions(-)
create mode 100644 lib/dpkg/db-fsys-load.c
diff --git a/lib/dpkg/Makefile.am b/lib/dpkg/Makefile.am
index 9ef3a37f7..b0243b157 100644
--- a/lib/dpkg/Makefile.am
+++ b/lib/dpkg/Makefile.am
@@ -76,6 +76,7 @@ libdpkg_la_SOURCES = \
db-fsys-digest.c \
db-fsys-divert.c \
db-fsys-files.c \
+ db-fsys-load.c \
db-fsys-override.c \
deb-version.c \
debug.c \
diff --git a/lib/dpkg/db-fsys-divert.c b/lib/dpkg/db-fsys-divert.c
index e0054bb35..351e8ef87 100644
--- a/lib/dpkg/db-fsys-divert.c
+++ b/lib/dpkg/db-fsys-divert.c
@@ -23,7 +23,6 @@
#include <compat.h>
#include <sys/types.h>
-#include <sys/stat.h>
#include <errno.h>
#include <string