List Info

Thread: Hash question: behavior of a hash with xmlHashAddEntry and xmlHashAddEntry2 types




Hash question: behavior of a hash with xmlHashAddEntry and xmlHashAddEntry2 types
user name
2007-03-19 14:56:45
Given that I have created a hash with xmlHashCreate:

1) Is it valid to populate it with calls to both xmlHashAddEntry and xmlHashAddEntry2 - in other words, having entries with one or two strings.
2) What is the behavior of xmlHashLookup and xmlHashLookup2 in such a case?

For example, is the following code valid?

 xmlHashAddEntry2(hash,BAD_CAST "Smokey",BAD_CAST "Bear",&;bear);
 xmlHashAddEntry(hash,"Smokey",&bandit);

And if so, what will  xmlHashLookup(hash,BAD_CAST "Smokey") return?

The hash documentation isn't clear on whether this is valid or not.

Re: Hash question: behavior of a hash with xmlHashAddEntry and xmlHashAddEntry2 types
user name
2007-03-20 10:51:45
On Mon, Mar 19, 2007 at 02:56:45PM -0500, David Hagood
wrote:
> Given that I have created a hash with xmlHashCreate:
> 
> 1) Is it valid to populate it with calls to both
xmlHashAddEntry and
> xmlHashAddEntry2 - in other words, having entries with
one or two strings.
> 2) What is the behavior of xmlHashLookup and
xmlHashLookup2 in such a case?
> 
> For example, is the following code valid?
> 
> xmlHashAddEntry2(hash,BAD_CAST
"Smokey",BAD_CAST "Bear",&bear);
> xmlHashAddEntry(hash,"Smokey",&bandit);
> 
> And if so, what will  xmlHashLookup(hash,BAD_CAST
"Smokey") return?
> 
> The hash documentation isn't clear on whether this is
valid or not.

  That should be valid xmlHashAddEntry is a call to
xmlHashAddEntry3 
with 2 extra NULL args, and xmlHashLookup is a call to
xmlHashLookup3
with 2 extra NULL args, everything is done internally with 3
args.
Note however that I never tried to mix in libxml2 code
itself.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/v
irtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillardredhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ |
Rpmfind RPM search engine  http://rpmfind.net/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
xmlgnome.org
http://mai
l.gnome.org/mailman/listinfo/xml

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )