summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authorThomas Broyer <tbroyer@src.gnome.org>2001-07-22 03:54:15 +0000
committerThomas Broyer <tbroyer@src.gnome.org>2001-07-22 03:54:15 +0000
commite812624729df8ecb507aaafb780bef39124f8d9f (patch)
treee904be01ec5152c636919fe0dafe4666bf0cee5e /hash.c
parent5e2dace1ca6fbb023d1ce848d4e98deefbbfec31 (diff)
downloadlibxml2-e812624729df8ecb507aaafb780bef39124f8d9f.tar.gz
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
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c40
1 files changed, 38 insertions, 2 deletions
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;
}