From e812624729df8ecb507aaafb780bef39124f8d9f Mon Sep 17 00:00:00 2001 From: Thomas Broyer Date: Sun, 22 Jul 2001 03:54:15 +0000 Subject: [PATCH] added xmlHashScannerFull, xmlHashScanFull and xmlHashScannFull3 to get * hash.c include/libxml/hash.h: added xmlHashScannerFull, xmlHashScanFull and xmlHashScannFull3 to get passed the three keys as arguments to the callback function --- ChangeLog | 6 ++++++ hash.c | 40 ++++++++++++++++++++++++++++++++++++++-- include/libxml/hash.h | 12 ++++++++++++ 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index a6be6140..22e5a344 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun Jul 22 05:56:16 CEST 2001 Thomas Broyer + + * hash.c include/libxml/hash.h: added xmlHashScannerFull, + xmlHashScanFull and xmlHashScannFull3 to get passed the + three keys as arguments to the callback function + Thu Jul 19 15:29:26 CEST 2001 Daniel Veillard * configure.in Makefile.am: removed libxml softlink for good diff --git a/hash.c b/hash.c index ab01352c..ed10394b 100644 --- a/hash.c +++ b/hash.c @@ -510,6 +510,19 @@ xmlHashLookup3(xmlHashTablePtr table, const xmlChar *name, */ void xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data) { + xmlHashScanFull (table, (xmlHashScannerFull) f, data); +} + +/** + * xmlHashScanFull: + * @table: the hash table + * @f: the scanner function for items in the hash + * @data: extra data passed to f + * + * Scan the hash table and applied f to each value. + */ +void +xmlHashScanFull(xmlHashTablePtr table, xmlHashScannerFull f, void *data) { int i; xmlHashEntryPtr iter; xmlHashEntryPtr next; @@ -525,7 +538,8 @@ xmlHashScan(xmlHashTablePtr table, xmlHashScanner f, void *data) { while (iter) { next = iter->next; if (f) - f(iter->payload, data, iter->name); + f(iter->payload, data, iter->name, + iter->name2, iter->name3); iter = next; } } @@ -549,6 +563,27 @@ void xmlHashScan3(xmlHashTablePtr table, const xmlChar *name, const xmlChar *name2, const xmlChar *name3, xmlHashScanner f, void *data) { + xmlHashScanFull3 (table, name, name2, name3, + (xmlHashScannerFull) f, data); +} + +/** + * xmlHashScanFull3: + * @table: the hash table + * @name: the name of the userdata or NULL + * @name2: a second name of the userdata or NULL + * @name3: a third name of the userdata or NULL + * @f: the scanner function for items in the hash + * @data: extra data passed to f + * + * Scan the hash table and applied f to each value matching + * (name, name2, name3) tuple. If one of the names is null, + * the comparison is considered to match. + */ +void +xmlHashScanFull3(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2, const xmlChar *name3, + xmlHashScannerFull f, void *data) { int i; xmlHashEntryPtr iter; xmlHashEntryPtr next; @@ -566,7 +601,8 @@ xmlHashScan3(xmlHashTablePtr table, const xmlChar *name, if (((name == NULL) || (xmlStrEqual(name, iter->name))) && ((name2 == NULL) || (xmlStrEqual(name2, iter->name2))) && ((name3 == NULL) || (xmlStrEqual(name3, iter->name3)))) { - f(iter->payload, data, iter->name); + f(iter->payload, data, iter->name, + iter->name2, iter->name3); } iter = next; } diff --git a/include/libxml/hash.h b/include/libxml/hash.h index 24476060..e3eb303f 100644 --- a/include/libxml/hash.h +++ b/include/libxml/hash.h @@ -36,6 +36,9 @@ typedef xmlHashTable *xmlHashTablePtr; typedef void (*xmlHashDeallocator)(void *payload, xmlChar *name); typedef void *(*xmlHashCopier)(void *payload, xmlChar *name); typedef void *(*xmlHashScanner)(void *payload, void *data, xmlChar *name); +typedef void (*xmlHashScannerFull)(void *payload, void *data, + const xmlChar *name, const xmlChar *name2, + const xmlChar *name3); /* * Constructor and destructor @@ -114,6 +117,15 @@ void xmlHashScan3 (xmlHashTablePtr table, const xmlChar *name3, xmlHashScanner f, void *data); +void xmlHashScanFull (xmlHashTablePtr table, + xmlHashScannerFull f, + void *data); +void xmlHashScanFull3(xmlHashTablePtr table, + const xmlChar *name, + const xmlChar *name2, + const xmlChar *name3, + xmlHashScannerFull f, + void *data); #ifdef __cplusplus } #endif