aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/libxml/dict.c
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:45:01 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:01 +0300
commit2d37894b1b037cf24231090eda8589bbb44fb6fc (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/libs/libxml/dict.c
parent718c552901d703c502ccbefdfc3c9028d608b947 (diff)
downloadydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/libxml/dict.c')
-rw-r--r--contrib/libs/libxml/dict.c144
1 files changed, 72 insertions, 72 deletions
diff --git a/contrib/libs/libxml/dict.c b/contrib/libs/libxml/dict.c
index 1618bc56dc..63febfb00c 100644
--- a/contrib/libs/libxml/dict.c
+++ b/contrib/libs/libxml/dict.c
@@ -38,8 +38,8 @@
* list we will use the BigKey algo as soon as the hash size grows
* over MIN_DICT_SIZE so this actually works
*/
-#if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME) && \
- !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
+#if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME) && \
+ !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
#define DICT_RANDOMIZATION
#endif
@@ -49,7 +49,7 @@
#else
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
-#elif defined(_WIN32)
+#elif defined(_WIN32)
typedef unsigned __int32 uint32_t;
#endif
#endif
@@ -89,7 +89,7 @@ typedef unsigned __int32 uint32_t;
#endif /* WITH_BIG_KEY */
/*
- * An entry in the dictionary
+ * An entry in the dictionary
*/
typedef struct _xmlDictEntry xmlDictEntry;
typedef xmlDictEntry *xmlDictEntryPtr;
@@ -112,7 +112,7 @@ struct _xmlDictStrings {
xmlChar array[1];
};
/*
- * The entire dictionary
+ * The entire dictionary
*/
struct _xmlDict {
int ref_counter;
@@ -207,7 +207,7 @@ xmlDictCleanup(void) {
/*
* xmlDictAddString:
- * @dict: the dictionary
+ * @dict: the dictionary
* @name: the name of the userdata
* @len: the length of the name
*
@@ -227,7 +227,7 @@ xmlDictAddString(xmlDictPtr dict, const xmlChar *name, unsigned int namelen) {
#endif
pool = dict->strings;
while (pool != NULL) {
- if ((size_t)(pool->end - pool->free) > namelen)
+ if ((size_t)(pool->end - pool->free) > namelen)
goto found_pool;
if (pool->size > size) size = pool->size;
limit += pool->size;
@@ -269,7 +269,7 @@ found_pool:
/*
* xmlDictAddQString:
- * @dict: the dictionary
+ * @dict: the dictionary
* @prefix: the prefix of the userdata
* @plen: the prefix length
* @name: the name of the userdata
@@ -295,7 +295,7 @@ xmlDictAddQString(xmlDictPtr dict, const xmlChar *prefix, unsigned int plen,
#endif
pool = dict->strings;
while (pool != NULL) {
- if ((size_t)(pool->end - pool->free) > namelen + plen + 1)
+ if ((size_t)(pool->end - pool->free) > namelen + plen + 1)
goto found_pool;
if (pool->size > size) size = pool->size;
limit += pool->size;
@@ -349,9 +349,9 @@ found_pool:
* http://burtleburtle.net/bob/hash/doobs.html
*/
-#ifdef __clang__
-ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow")
-#endif
+#ifdef __clang__
+ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow")
+#endif
static uint32_t
xmlDictComputeBigKey(const xmlChar* data, int namelen, int seed) {
uint32_t hash;
@@ -384,9 +384,9 @@ xmlDictComputeBigKey(const xmlChar* data, int namelen, int seed) {
*
* Neither of the two strings must be NULL.
*/
-#ifdef __clang__
-ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow")
-#endif
+#ifdef __clang__
+ATTRIBUTE_NO_SANITIZE("unsigned-integer-overflow")
+#endif
static unsigned long
xmlDictComputeBigQKey(const xmlChar *prefix, int plen,
const xmlChar *name, int len, int seed)
@@ -437,23 +437,23 @@ xmlDictComputeFastKey(const xmlChar *name, int namelen, int seed) {
}
switch (namelen) {
case 10: value += name[9];
- /* Falls through. */
+ /* Falls through. */
case 9: value += name[8];
- /* Falls through. */
+ /* Falls through. */
case 8: value += name[7];
- /* Falls through. */
+ /* Falls through. */
case 7: value += name[6];
- /* Falls through. */
+ /* Falls through. */
case 6: value += name[5];
- /* Falls through. */
+ /* Falls through. */
case 5: value += name[4];
- /* Falls through. */
+ /* Falls through. */
case 4: value += name[3];
- /* Falls through. */
+ /* Falls through. */
case 3: value += name[2];
- /* Falls through. */
+ /* Falls through. */
case 2: value += name[1];
- /* Falls through. */
+ /* Falls through. */
default: break;
}
return(value);
@@ -479,35 +479,35 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
value += 30 * (*prefix);
if (len > 10) {
- int offset = len - (plen + 1 + 1);
- if (offset < 0)
- offset = len - (10 + 1);
- value += name[offset];
+ int offset = len - (plen + 1 + 1);
+ if (offset < 0)
+ offset = len - (10 + 1);
+ value += name[offset];
len = 10;
if (plen > 10)
plen = 10;
}
switch (plen) {
case 10: value += prefix[9];
- /* Falls through. */
+ /* Falls through. */
case 9: value += prefix[8];
- /* Falls through. */
+ /* Falls through. */
case 8: value += prefix[7];
- /* Falls through. */
+ /* Falls through. */
case 7: value += prefix[6];
- /* Falls through. */
+ /* Falls through. */
case 6: value += prefix[5];
- /* Falls through. */
+ /* Falls through. */
case 5: value += prefix[4];
- /* Falls through. */
+ /* Falls through. */
case 4: value += prefix[3];
- /* Falls through. */
+ /* Falls through. */
case 3: value += prefix[2];
- /* Falls through. */
+ /* Falls through. */
case 2: value += prefix[1];
- /* Falls through. */
+ /* Falls through. */
case 1: value += prefix[0];
- /* Falls through. */
+ /* Falls through. */
default: break;
}
len -= plen;
@@ -517,25 +517,25 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
}
switch (len) {
case 10: value += name[9];
- /* Falls through. */
+ /* Falls through. */
case 9: value += name[8];
- /* Falls through. */
+ /* Falls through. */
case 8: value += name[7];
- /* Falls through. */
+ /* Falls through. */
case 7: value += name[6];
- /* Falls through. */
+ /* Falls through. */
case 6: value += name[5];
- /* Falls through. */
+ /* Falls through. */
case 5: value += name[4];
- /* Falls through. */
+ /* Falls through. */
case 4: value += name[3];
- /* Falls through. */
+ /* Falls through. */
case 3: value += name[2];
- /* Falls through. */
+ /* Falls through. */
case 2: value += name[1];
- /* Falls through. */
+ /* Falls through. */
case 1: value += name[0];
- /* Falls through. */
+ /* Falls through. */
default: break;
}
return(value);
@@ -546,7 +546,7 @@ xmlDictComputeFastQKey(const xmlChar *prefix, int plen,
*
* Create a new dictionary
*
- * Returns the newly created dictionary, or NULL if an error occurred.
+ * Returns the newly created dictionary, or NULL if an error occurred.
*/
xmlDictPtr
xmlDictCreate(void) {
@@ -586,14 +586,14 @@ xmlDictCreate(void) {
/**
* xmlDictCreateSub:
- * @sub: an existing dictionary
+ * @sub: an existing dictionary
*
* Create a new dictionary, inheriting strings from the read-only
- * dictionary @sub. On lookup, strings are first searched in the
- * new dictionary, then in @sub, and if not found are created in the
- * new dictionary.
+ * dictionary @sub. On lookup, strings are first searched in the
+ * new dictionary, then in @sub, and if not found are created in the
+ * new dictionary.
*
- * Returns the newly created dictionary, or NULL if an error occurred.
+ * Returns the newly created dictionary, or NULL if an error occurred.
*/
xmlDictPtr
xmlDictCreateSub(xmlDictPtr sub) {
@@ -612,7 +612,7 @@ xmlDictCreateSub(xmlDictPtr sub) {
/**
* xmlDictReference:
- * @dict: the dictionary
+ * @dict: the dictionary
*
* Increment the reference counter of a dictionary
*
@@ -633,10 +633,10 @@ xmlDictReference(xmlDictPtr dict) {
/**
* xmlDictGrow:
- * @dict: the dictionary
- * @size: the new size of the dictionary
+ * @dict: the dictionary
+ * @size: the new size of the dictionary
*
- * resize the dictionary
+ * resize the dictionary
*
* Returns 0 in case of success, -1 in case of failure
*/
@@ -711,8 +711,8 @@ xmlDictGrow(xmlDictPtr dict, size_t size) {
dict->dict[key].next = entry;
} else {
/*
- * we don't have much ways to alert from here
- * result is losing an entry and unicity guarantee
+ * we don't have much ways to alert from here
+ * result is losing an entry and unicity guarantee
*/
ret = -1;
}
@@ -768,7 +768,7 @@ xmlDictGrow(xmlDictPtr dict, size_t size) {
/**
* xmlDictFree:
- * @dict: the dictionary
+ * @dict: the dictionary
*
* Free the hash @dict and its contents. The userdata is
* deallocated with @f if provided.
@@ -830,11 +830,11 @@ xmlDictFree(xmlDictPtr dict) {
/**
* xmlDictLookup:
- * @dict: the dictionary
+ * @dict: the dictionary
* @name: the name of the userdata
* @len: the length of the name, if -1 it is recomputed
*
- * Add the @name to the dictionary @dict if not present.
+ * Add the @name to the dictionary @dict if not present.
*
* Returns the internal copy of the name or NULL in case of internal error
*/
@@ -970,11 +970,11 @@ xmlDictLookup(xmlDictPtr dict, const xmlChar *name, int len) {
/**
* xmlDictExists:
- * @dict: the dictionary
+ * @dict: the dictionary
* @name: the name of the userdata
* @len: the length of the name, if -1 it is recomputed
*
- * Check if the @name exists in the dictionary @dict.
+ * Check if the @name exists in the dictionary @dict.
*
* Returns the internal copy of the name or NULL if not found.
*/
@@ -1078,7 +1078,7 @@ xmlDictExists(xmlDictPtr dict, const xmlChar *name, int len) {
/**
* xmlDictQLookup:
- * @dict: the dictionary
+ * @dict: the dictionary
* @prefix: the prefix
* @name: the name
*
@@ -1183,10 +1183,10 @@ xmlDictQLookup(xmlDictPtr dict, const xmlChar *prefix, const xmlChar *name) {
/**
* xmlDictOwns:
- * @dict: the dictionary
+ * @dict: the dictionary
* @str: the string
*
- * check if a string is owned by the dictionary
+ * check if a string is owned by the dictionary
*
* Returns 1 if true, 0 if false and -1 in case of error
* -1 in case of error
@@ -1210,11 +1210,11 @@ xmlDictOwns(xmlDictPtr dict, const xmlChar *str) {
/**
* xmlDictSize:
- * @dict: the dictionary
+ * @dict: the dictionary
*
* Query the number of elements installed in the hash @dict.
*
- * Returns the number of elements in the dictionary or
+ * Returns the number of elements in the dictionary or
* -1 in case of error
*/
int
@@ -1228,7 +1228,7 @@ xmlDictSize(xmlDictPtr dict) {
/**
* xmlDictSetLimit:
- * @dict: the dictionary
+ * @dict: the dictionary
* @limit: the limit in bytes
*
* Set a size limit for the dictionary
@@ -1249,7 +1249,7 @@ xmlDictSetLimit(xmlDictPtr dict, size_t limit) {
/**
* xmlDictGetUsage:
- * @dict: the dictionary
+ * @dict: the dictionary
*
* Get how much memory is used by a dictionary for strings
* Added in 2.9.0