summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2014-07-01 02:40:11 +0200
committerGuillem Jover <guillem@debian.org>2014-08-09 22:38:07 +0200
commitbdfc98f46c81b56b895e436e3652b553fa106ce9 (patch)
tree0603e16f9d2c775c299172c81df942413f95800a /lib
parent78c18f294df6956eac2bba8af31a26cfc1f24381 (diff)
downloaddpkg-bdfc98f46c81b56b895e436e3652b553fa106ce9.tar.gz
libdpkg: Add new varbuf_add_arbfield()
Diffstat (limited to 'lib')
-rw-r--r--lib/dpkg/dump.c18
-rw-r--r--lib/dpkg/libdpkg.map1
-rw-r--r--lib/dpkg/parsedump.h4
3 files changed, 19 insertions, 4 deletions
diff --git a/lib/dpkg/dump.c b/lib/dpkg/dump.c
index 90a38dbd3..4525f3244 100644
--- a/lib/dpkg/dump.c
+++ b/lib/dpkg/dump.c
@@ -427,6 +427,19 @@ w_trigaw(struct varbuf *vb,
}
void
+varbuf_add_arbfield(struct varbuf *vb, const struct arbitraryfield *arbfield,
+ enum fwriteflags flags)
+{
+ if (flags & fw_printheader) {
+ varbuf_add_str(vb, arbfield->name);
+ varbuf_add_str(vb, ": ");
+ }
+ varbuf_add_str(vb, arbfield->value);
+ if (flags & fw_printheader)
+ varbuf_add_char(vb, '\n');
+}
+
+void
varbufrecord(struct varbuf *vb,
const struct pkginfo *pkg, const struct pkgbin *pkgbin)
{
@@ -437,10 +450,7 @@ varbufrecord(struct varbuf *vb,
fip->wcall(vb, pkg, pkgbin, fw_printheader, fip);
}
for (afp = pkgbin->arbs; afp; afp = afp->next) {
- varbuf_add_str(vb, afp->name);
- varbuf_add_str(vb, ": ");
- varbuf_add_str(vb, afp->value);
- varbuf_add_char(vb, '\n');
+ varbuf_add_arbfield(vb, afp, fw_printheader);
}
}
diff --git a/lib/dpkg/libdpkg.map b/lib/dpkg/libdpkg.map
index ecfe941ee..6368d31ee 100644
--- a/lib/dpkg/libdpkg.map
+++ b/lib/dpkg/libdpkg.map
@@ -304,6 +304,7 @@ LIBDPKG_PRIVATE {
versionsatisfied;
# Package on-disk database functions
+ varbuf_add_arbfield;
varbufdependency;
varbufrecord;
writerecord;
diff --git a/lib/dpkg/parsedump.h b/lib/dpkg/parsedump.h
index d1c32efc6..9387a3e11 100644
--- a/lib/dpkg/parsedump.h
+++ b/lib/dpkg/parsedump.h
@@ -116,6 +116,10 @@ fwritefunction w_architecture;
fwritefunction w_filecharf;
fwritefunction w_trigpend, w_trigaw;
+void
+varbuf_add_arbfield(struct varbuf *vb, const struct arbitraryfield *arbfield,
+ enum fwriteflags flags);
+
struct fieldinfo {
const char *name;
freadfunction *rcall;