Re: [xml] xmlHashScanner type ought to return a bool...
- From: Daniel Veillard <veillard redhat com>
- To: David Hagood <wowbagger sktc net>
- Cc: xml gnome org
- Subject: Re: [xml] xmlHashScanner type ought to return a bool...
- Date: Fri, 26 Jan 2007 09:18:37 -0500
On Thu, Jan 25, 2007 at 02:52:10PM -0600, David Hagood wrote:
I'd like to suggest that the various xmlHashScan functions be modified so
that the function pointer passed to them can return a bool indicating
whether the scan should continue or not.
I have a case where I have to basically reverse a hash scan - given
something about the data hashed, locate a string that maps to that data.
So what I might have is:
struct something
{
int a;
int b;
};
and a hash mapping a bunch of strings to different instances of something.
Now, I want to find a string which maps to a "something" with a .a value
of 12.
Now, unless I have some other entity besides the hash which lists all the
possible somethings, the only way to find a "something" with .a=12 would
be to create a hash scanner function that checks each item in the hash and
records the first item which has .a=12 - but then I am going to iterate
over the whole rest of the hash after having found my object.
If the hash scanner function could return TRUE = (continue scanning) or
FALSE = (stop scanning), then I could stop the search when I've found the
data.
That would be a good idea, except it break both API compatibility and
ABI compatibility with previous versions, so that's just impossible. And
I'm not sure it's worth adding a new API at this point.
Daniel
--
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard | virtualization library http://libvirt.org/
veillard redhat com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]