This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Don't assume order of xml attributes
- From: Daniel Jacobowitz <dan at codesourcery dot com>
- To: Pedro Alves <pedro at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 2 Feb 2011 11:33:52 -0500
- Subject: Re: Don't assume order of xml attributes
- References: <201102021619.36863.pedro@codesourcery.com>
On Wed, Feb 02, 2011 at 04:19:36PM +0000, Pedro Alves wrote:
> Something I noticed by inspection while adding support for
> a new xml file fetched with qXfer:$object.
>
> XML attributes are not ordered. We should not
> rely on attribute order for anything. This patch
> adds a helper function to get at a given attribute by name,
> and updates all places to use it instead of refering to
> attributes by index.
This was not required. The attributes don't have to be ordered in the
XML file, but they're ordered in the VEC because we create it that way
in gdb_start_element. You can tell your patch still relies on this
code because the calls to the lookup function mostly don't check for
NULL.
That said, I don't think a linear search for attribute names is going
to be too slow :-) So this is a nice readability improvement anyway.
--
Daniel Jacobowitz
CodeSourcery