From d194dd289250f4bea6247115b722b2de37e1866b Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Wed, 14 Feb 2001 10:37:43 +0000 Subject: [PATCH] - hash.[ch]: added Paolo Casarini patch to provide Delete from hash functionnalities. - doc/html/* : rebuild the doc Daniel --- ChangeLog | 6 + doc/html/libxml-debugxml.html | 40 ++-- doc/html/libxml-encoding.html | 52 ++--- doc/html/libxml-entities.html | 48 ++-- doc/html/libxml-htmlparser.html | 83 +++---- doc/html/libxml-htmltree.html | 36 +-- doc/html/libxml-nanoftp.html | 54 ++--- doc/html/libxml-nanohttp.html | 30 +-- doc/html/libxml-parser.html | 112 ++++++---- doc/html/libxml-parserinternals.html | 230 +++++++++---------- doc/html/libxml-sax.html | 82 +++---- doc/html/libxml-tree.html | 320 +++++++++++++-------------- doc/html/libxml-uri.html | 38 ++-- doc/html/libxml-valid.html | 134 +++++------ doc/html/libxml-xinclude.html | 10 +- doc/html/libxml-xmlio.html | 88 ++++---- doc/html/libxml-xmlmemory.html | 46 ++-- doc/html/libxml-xpath.html | 78 +++---- doc/html/libxml-xpathinternals.html | 206 +++++++++-------- doc/html/libxml-xpointer.html | 26 +-- hash.c | 87 ++++++++ hash.h | 12 + include/libxml/hash.h | 12 + 23 files changed, 988 insertions(+), 842 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2d5854b1..9a47de2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Feb 14 11:35:39 CET 2001 Daniel Veillard + + * hash.[ch]: added Paolo Casarini patch to provide Delete from + hash functionnalities. + * doc/html/* : rebuild the doc + Tue Feb 13 18:01:48 CET 2001 Daniel Veillard * xpath.c result/XPath/tests/chaptersprefol: bugfixes on order and diff --git a/doc/html/libxml-debugxml.html b/doc/html/libxml-debugxml.html index aafcc767..7742e48e 100644 --- a/doc/html/libxml-debugxml.html +++ b/doc/html/libxml-debugxml.html @@ -121,7 +121,7 @@ NAME="LIBXML-DEBUGXML" >

Name

Synopsis

Description

Details
















Name

Synopsis

Description

Details






















Name

Synopsis

Description

Details




















Name

Synopsis

Description

Details










struct htmlElemDesc { const char *name; /* The tag name */ - int startTag; /* Whether the start tag can be implied */ - int endTag; /* Whether the end tag can be implied */ - int empty; /* Is this an empty element ? */ - int depr; /* Is this a deprecated element ? */ - int dtd; /* 1: only in Loose DTD, 2: only Frameset one */ + char startTag; /* Whether the start tag can be implied */ + char endTag; /* Whether the end tag can be implied */ + char saveEndTag; /* Whether the end tag should be saved */ + char empty; /* Is this an empty element ? */ + char depr; /* Is this a deprecated element ? */ + char dtd; /* 1: only in Loose DTD, 2: only Frameset one */ const char *desc; /* the description */ };






















Name

Synopsis

Description

Details














Name

Synopsis

Description

Details























Name

Synopsis

Description

Details











a strncat for array of xmlChar's

a strncat for array of xmlChar's, it will extend cur with the len +first bytes of add.

a new xmlChar * containing the concatenated string.a new xmlChar *, the original cur is reallocated if needed +and should not be freed
















































Name

Synopsis

Description

Details















































































































Name

Synopsis

Description

Details





































Name

Synopsis

Description

Details




























































































































































Name

Synopsis

Description

Details










applies the 5 normalization steps to a path string -Normalization occurs directly on the string, no new allocation is done

Applies the 5 normalization steps to a path string--that is, RFC 2396 +Section 5.2, steps 6.c through 6.g.

Normalization occurs directly on the string, no new allocation is done



Name

Synopsis

Description

Details































































Name

Synopsis

Description

Details

Name

Synopsis

Description

Details








































Name

Synopsis

Description

Details



















Name

Synopsis

Description

Details


































-2 in case of error 1 if first point < second point, 0 if -that's the same point, -1 otherwise

Name

Synopsis

Description

Details












































Return 1 if predicate is true, 0 otherwise






















Implement the div operation on XPath objects: +>Implement the div operation on XPath objects arg1 / arg2: The numeric operators convert their operands to numbers as if by calling the number function.


Implement the div operation on XPath objects: Implement the mod operation on XPath objects: arg1

























Name

Synopsis

Description

Details









nbElems); } + +/** + * @table: the hash table + * @name: the name of the userdata + * @f: the deallocator function for removed item (if any) + * + * Find the userdata specified by the (name, name2, name3) tuple and remove + * it from the hash table. Existing userdata for this tuple will be removed + * and freed with @f. + * + * Returns 0 if the removal succeeded and -1 in case of error or not found. + */ +int xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, + xmlHashDeallocator f) { + return(xmlHashRemoveEntry3(table, name, NULL, NULL, f)); +} + +/** + * @table: the hash table + * @name: the name of the userdata + * @name2: a second name of the userdata + * @f: the deallocator function for removed item (if any) + * + * Find the userdata specified by the (name, name2, name3) tuple and remove + * it from the hash table. Existing userdata for this tuple will be removed + * and freed with @f. + * + * Returns 0 if the removal succeeded and -1 in case of error or not found. + */ +int xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2, xmlHashDeallocator f) { + return(xmlHashRemoveEntry3(table, name, name2, NULL, f)); +} + +/** + * @table: the hash table + * @name: the name of the userdata + * @name2: a second name of the userdata + * @name3: a third name of the userdata + * @f: the deallocator function for removed item (if any) + * + * Find the userdata specified by the (name, name2, name3) tuple and remove + * it from the hash table. Existing userdata for this tuple will be removed + * and freed with @f. + * + * Returns 0 if the removal succeeded and -1 in case of error or not found. + */ +int xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2, const xmlChar *name3, + xmlHashDeallocator f) { + unsigned long key; + xmlHashEntryPtr entry; + xmlHashEntryPtr prev = NULL; + + if (table == NULL || name == NULL) + return(-1); + + key = xmlHashComputeKey(table, name); + if (table->table[key] == NULL) { + return(-1); + } else { + for (entry = table->table[key]; entry != NULL; entry = entry->next) { + if (xmlStrEqual(entry->name, name) && + xmlStrEqual(entry->name2, name2) && + xmlStrEqual(entry->name3, name3)) { + if(f) + f(entry->payload, entry->name); + entry->payload = NULL; + if(entry->name) + xmlFree(entry->name); + if(entry->name2) + xmlFree(entry->name2); + if(entry->name3) + xmlFree(entry->name3); + if(prev) + prev->next = entry->next; + else + table->table[key] = entry->next; + xmlFree(entry); + table->nbElems--; + return(0); + } + prev = entry; + } + return(-1); + } +} \ No newline at end of file diff --git a/hash.h b/hash.h index 0b48d9b9..c88fffd1 100644 --- a/hash.h +++ b/hash.h @@ -74,6 +74,18 @@ int xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name3, void *userdata, xmlHashDeallocator f); + +/* + * Remove an entry from the hash table + */ +int xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, + xmlHashDeallocator f); +int xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2, xmlHashDeallocator f); +int xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2, const xmlChar *name3, + xmlHashDeallocator f); + /* * Retrieve the userdata */ diff --git a/include/libxml/hash.h b/include/libxml/hash.h index 0b48d9b9..c88fffd1 100644 --- a/include/libxml/hash.h +++ b/include/libxml/hash.h @@ -74,6 +74,18 @@ int xmlHashUpdateEntry3(xmlHashTablePtr table, const xmlChar *name3, void *userdata, xmlHashDeallocator f); + +/* + * Remove an entry from the hash table + */ +int xmlHashRemoveEntry(xmlHashTablePtr table, const xmlChar *name, + xmlHashDeallocator f); +int xmlHashRemoveEntry2(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2, xmlHashDeallocator f); +int xmlHashRemoveEntry3(xmlHashTablePtr table, const xmlChar *name, + const xmlChar *name2, const xmlChar *name3, + xmlHashDeallocator f); + /* * Retrieve the userdata */