This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Don't assume order of xml attributes


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]