The following commit has been merged in the master branch:
commit b3f669039f128d715ac7ac71abaeac86f0954112
Author: Guillem Jover <[email protected]>
Date: Sun Feb 20 01:46:59 2011 +0100
libdpkg: Switch pri_other to be a fallback namevalue
diff --git a/lib/dpkg/fields.c b/lib/dpkg/fields.c
index 5ebd8b0..5ff7697 100644
--- a/lib/dpkg/fields.c
+++ b/lib/dpkg/fields.c
@@ -36,7 +36,7 @@
static int
convert_string(struct parsedb_state *ps, const struct pkginfo *pigp,
const char *what, const struct namevalue *ivip,
- const char *startp, const char **endpp, int otherwise)
+ const char *startp, const char **endpp)
{
const char *ep;
const struct namevalue *nvip;
@@ -45,10 +45,8 @@ convert_string(struct parsedb_state *ps, const struct
pkginfo *pigp,
parse_error(ps, pigp, _("%s is missing"), what);
nvip = namevalue_find_by_name(ivip, startp);
- if (nvip == NULL) {
- if (otherwise != -1) return otherwise;
+ if (nvip == NULL)
parse_error(ps, pigp, _("'%.50s' is not allowed for %s"), startp, what);
- }
ep = startp + nvip->length;
while (isspace(*ep))
@@ -136,7 +134,7 @@ f_boolean(struct pkginfo *pigp, struct pkgbin *pifp,
return;
boolean = convert_string(ps, pigp, _("yes/no in boolean field"),
- booleaninfos, value, NULL, -1);
+ booleaninfos, value, NULL);
PKGPFIELD(pifp, fip->integer, bool) = boolean;
}
@@ -156,7 +154,7 @@ f_priority(struct pkginfo *pigp, struct pkgbin *pifp,
{
if (!*value) return;
pigp->priority = convert_string(ps, pigp, _("word in `priority' field"),
- priorityinfos, value, NULL, pri_other);
+ priorityinfos, value, NULL);
if (pigp->priority == pri_other) pigp->otherpriority= nfstrsave(value);
}
@@ -175,13 +173,13 @@ f_status(struct pkginfo *pigp, struct pkgbin *pifp,
pigp->want = convert_string(ps, pigp,
_("first (want) word in `status' field"),
- wantinfos, value, &ep, -1);
+ wantinfos, value, &ep);
pigp->eflag = convert_string(ps, pigp,
_("second (error) word in `status' field"),
- eflaginfos, ep, &ep, -1);
+ eflaginfos, ep, &ep);
pigp->status = convert_string(ps, pigp,
_("third (status) word in `status' field"),
- statusinfos, ep, NULL, -1);
+ statusinfos, ep, NULL);
}
void
diff --git a/lib/dpkg/parsehelp.c b/lib/dpkg/parsehelp.c
index 0a92a35..0d74d55 100644
--- a/lib/dpkg/parsehelp.c
+++ b/lib/dpkg/parsehelp.c
@@ -84,7 +84,7 @@ const struct namevalue priorityinfos[] = {
NAMEVALUE_DEF("standard", pri_standard),
NAMEVALUE_DEF("optional", pri_optional),
NAMEVALUE_DEF("extra", pri_extra),
- NAMEVALUE_DEF("this is a bug - please report", pri_other),
+ NAMEVALUE_FALLBACK_DEF("this is a bug - please report", pri_other),
NAMEVALUE_DEF("unknown", pri_unknown),
{ .name = NULL }
};
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]