+2008-07-02 Guillem Jover <guillem@debian.org>
+
+ * lib/fields.c (convert_string): Change nvip to be const and use a
+ proper assignment instead of a sneaky cast through memcpy. Remove
+ unneeded length caching as all current namevalue arrays have it
+ precomputed.
+
2008-07-02 Guillem Jover <guillem@debian.org>
* lib/fields.c (convert_string): Use a capped string length instead
const char **endpp)
{
const char *ep;
- int c, l = 0;
- struct namevalue *nvip= NULL;
- memcpy(&nvip,&ivip,sizeof(struct namevalue *));
+ int c;
+ const struct namevalue *nvip = ivip;
ep= startp;
if (!*ep)
parse_error(filename, lno, pigp, _("%s is missing"), what);
while (nvip->name) {
- if ((l= nvip->length) == 0) {
- l= strlen(nvip->name);
- nvip->length= (const int)l;
- }
- if (strncasecmp(nvip->name,startp,l) || nvip->name[l])
+ if (strncasecmp(nvip->name, startp, nvip->length))
nvip++;
else
break;
parse_error(filename, lno, pigp, _("`%.*s' is not allowed for %s"),
strnlen(startp, 50), startp, what);
}
- ep = startp + l;
+ ep = startp + nvip->length;
c = *ep;
while (isspace(c)) c= *++ep;
if (c && !endpp)