[xml] xmlHashScanner type ought to return a bool...



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.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]