Re: [xml] xmlHashScan and *data argument



On Sunday 19 October 2003 23:43, Daniel Veillard wrote:
On Sun, Oct 19, 2003 at 11:31:54PM +0200, Melvyn Sopacua wrote:
Content-Description: signed data

On Sunday 19 October 2003 23:01, Daniel Veillard wrote:
On Sun, Oct 19, 2003 at 10:43:33PM +0200, Melvyn Sopacua wrote:
Content-Description: signed data

This works:
=====================================================================
=== void printElementStructured(xmlElementPtr el)

[...]

This doesn't:
=====================================================================
=== void printElementStructured(int *level, xmlElementPtr el)
{

[...]

        xmlHashScan(table, (xmlHashScanner) printElementStructured, &level);

For the first version, the call to xmlHashScan is:
xmlHashScan(table, (xmlHashScanner) printElementStructured, NULL);

so there is no data argument passed.
Just to be clear: these are two tries for the same program.

 And you're surprised ?
 Your problem is the use of the C language apparently. You cannot
expect to shuffle arguments and have the compiler guess magically that
your interface changed and reorder arguments.

Ehm - then I don't know why your own code in valid.c works.

  I don't see the point. I just looked at your mail, and if the first
version works, then obviously the second version cannot work.

How is the second version different from:

  I dunno. So then your first version should not work, but you reported it
as "working", but you can't obviously have both "working".

I still don't get why xmlDumpElementDecl accepts buf as first argument while 
it is an xmlHashScanner on an xmlElementTable - the same as I'm doing.

I won't dwell on it, but if you can explain it, I can sleep better ;)

Further investigation shows that xmlSchemaTypeDump in xmlschema.c indeed
has the argument order you list and swapping the arguments in my function
works.

  Okay, normal. There is actually  3rd argument passed if you look at the
declaration of xmlHashScanner() in libxml/hash.h

Yes - the name associated. I suppose that's the name in the _xmlHashEntry 
struct, and judging from xmlAddElementDecl that would be identical to 
xmlDtdElement->name.

-- 
Melvyn

Attachment: pgpJDYwGJiye3.pgp
Description: signature



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