[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r18301 - trunk/subversion/libsvn_ra_serf

From: Peter N. Lundblad <peter_at_famlundblad.se>
Date: 2006-01-31 21:35:35 CET

On Tue, 31 Jan 2006, Daniel Rall wrote:

> On Mon, 30 Jan 2006, jerenkrantz@tigris.org wrote:
> ...
> > +static const char *
> > +find_attr(const char **attrs, const char *attr_name)
> > +{
> > + const char *attr_val = NULL;
> > + const char **tmp_attrs = attrs;
> > +
> > + while (*tmp_attrs)
> > + {
> > + if (strcmp(*tmp_attrs, attr_name) == 0)
> > + {
> > + attr_val = attrs[1];
> > + }
> > + tmp_attrs += 2;
> > + }
> > +
> > + return attr_val;
> > +}
>
> Is it correct to continue to overwrite ATTR_VAL (always with the first
> value from ATTRS) until ATTR_NAME is no longer found in ATTRS (which I
> assume is a list of name/value pairs), rather than stopping looking
> after the first instance of ATTR_NAME is encountered, or at least
> taking the new value for ATTR_NAME? Answers would be useful in the
> doc string.
>
More than one attribute with the same name in a start or empty-element tag
is not well-formed XML, so the parser has to error out in that case.
OTOH, there's no reason to not break early, but that's a minor
optimization.

Thanks,
//Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Jan 31 21:37:54 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.