summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2011-02-20 01:46:59 +0100
committerGuillem Jover <guillem@debian.org>2011-03-02 07:35:00 +0100
commitb3f669039f128d715ac7ac71abaeac86f0954112 (patch)
treec8f9d23e13a8235b04542068bc55870a03455102
parent902cc15dc86797966ea09f66b26a433c7c85c64f (diff)
downloaddpkg-b3f669039f128d715ac7ac71abaeac86f0954112.tar.gz
libdpkg: Switch pri_other to be a fallback namevalue
-rw-r--r--lib/dpkg/fields.c16
-rw-r--r--lib/dpkg/parsehelp.c2
2 files changed, 8 insertions, 10 deletions
diff --git a/lib/dpkg/fields.c b/lib/dpkg/fields.c
index 5ebd8b02f..5ff7697e8 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 0a92a3501..0d74d5560 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 }
};