104 *(*relinquish_key)(
void *),
163 next->
value=(
void *) value;
167 list_info->
next=next;
169 list_info->
head=next;
172 list_info->
tail=next;
205 void *(*relinquish_value)(
void *))
216 next=list_info->
head;
219 if (relinquish_value != (
void *(*)(
void *)) NULL)
265 p=(
const char *) target;
266 q=(
const char *) source;
344 for (i=0; i < (ssize_t) hashmap_info->
capacity; i++)
346 list_info=hashmap_info->
map[i];
369 return(hashmap_info);
399 void *(*relinquish_value)(
void *))
412 if (relinquish_value != (
void *(*)(
void *)) NULL)
455 return((
void *) NULL);
500 list_info=hashmap_info->
map[hashmap_info->
next];
517 hashmap_info->
next++;
520 return((
void *) NULL);
561 list_info=hashmap_info->
map[hashmap_info->
next];
578 hashmap_info->
next++;
581 return((
void *) NULL);
617 return((
void *) NULL);
728 if (key == (
const void *) NULL)
729 return((
void *) NULL);
731 hash=hashmap_info->
hash(key);
732 list_info=hashmap_info->
map[hash % hashmap_info->
capacity];
739 if (entry->
hash == hash)
747 compare=hashmap_info->
compare(key,entry->
key);
759 return((
void *) NULL);
803 return((
void *) NULL);
811 if (index == (list_info->
elements-1))
817 next=list_info->
head;
818 for (i=0; i < (ssize_t) index; i++)
853 hash=(size_t) pointer;
854 hash+=(~(hash << 9));
907 for (i=0; i < 8; i++)
956 for (i=0; i < 8; i++)
1001 if (value == (
const void *) NULL)
1003 if ((index > list_info->
elements) ||
1009 next->
value=(
void *) value;
1015 list_info->
next=next;
1016 list_info->
head=next;
1017 list_info->
tail=next;
1023 if (list_info->
next == list_info->
head)
1024 list_info->
next=next;
1026 list_info->
head=next;
1032 list_info->
next=next;
1034 list_info->
tail=next;
1041 element=list_info->
head;
1043 for (i=1; i < (ssize_t) index; i++)
1045 element=element->
next;
1051 list_info->
next=next;
1092 LinkedListInfo *list_info,
int (*compare)(
const void *,
const void *),
1093 void **replace,
const void *value)
1106 if ((compare == (
int (*)(
const void *,
const void *)) NULL) ||
1107 (value == (
const void *) NULL))
1114 next->
value=(
void *) value;
1120 i=(ssize_t) compare(value,next->
next->
value);
1121 if ((i < 0) || ((replace != (
void **) NULL) && (i == 0)))
1135 list_info->
head=next;
1146 list_info->
head=next;
1147 list_info->
tail=next;
1249 if (array == (
void **) NULL)
1252 next=list_info->
head;
1255 array[i]=next->
value;
1306 size_t (*hash)(
const void *),
1308 void *(*relinquish_key)(
void *),
void *(*relinquish_value)(
void *))
1318 if (hash != (
size_t (*)(
const void *)) NULL)
1319 hashmap_info->
hash=hash;
1322 hashmap_info->
compare=compare;
1328 if (~capacity >= 1UL)
1330 capacity+1UL,
sizeof(*hashmap_info->
map));
1334 sizeof(*hashmap_info->
map));
1337 return(hashmap_info);
1372 list_info->
capacity=capacity == 0 ? (size_t) (~0) : capacity;
1413 #define MaxCapacities 20
1418 17, 31, 61, 131, 257, 509, 1021, 2053, 4099, 8191, 16381, 32771,
1419 65537, 131071, 262147, 524287, 1048573, 2097143, 4194301, 8388617
1445 if (hashmap_info->
capacity < capacities[i])
1447 if (i >= (MaxCapacities-1))
1449 capacity=capacities[i+1];
1458 for (i=0; i < (ssize_t) hashmap_info->
capacity; i++)
1463 list_info=hashmap_info->
map[i];
1472 map_info=map[entry->
hash % capacity];
1476 map[entry->
hash % capacity]=map_info;
1478 map_info->
next=element;
1480 map_info->
head=element;
1490 hashmap_info->
map=map;
1496 const void *key,
const void *value)
1510 if ((key == (
void *) NULL) || (value == (
void *) NULL))
1516 next->
hash=hashmap_info->
hash(key);
1517 next->
key=(
void *) key;
1518 next->
value=(
void *) value;
1529 for (i=0; entry != (
EntryInfo *) NULL; i++)
1539 compare=hashmap_info->
compare(key,entry->
key);
1605 if ((list_info->
elements == 0) || (value == (
const void *) NULL))
1606 return((
void *) NULL);
1610 if (list_info->
next == list_info->
head)
1612 next=list_info->
head;
1621 next=list_info->
head;
1628 return((
void *) NULL);
1632 if (element == list_info->
tail)
1633 list_info->
tail=next;
1634 if (list_info->
next == element)
1640 return((
void *) value);
1684 return((
void *) NULL);
1688 if (list_info->
next == list_info->
head)
1691 next=list_info->
head;
1700 next=list_info->
head;
1701 for (i=1; i < (ssize_t) index; i++)
1705 if (element == list_info->
tail)
1706 list_info->
tail=next;
1707 if (list_info->
next == element)
1709 value=element->
value;
1761 if (key == (
const void *) NULL)
1762 return((
void *) NULL);
1764 hash=hashmap_info->
hash(key);
1765 list_info=hashmap_info->
map[hash % hashmap_info->
capacity];
1770 for (i=0; entry != (
EntryInfo *) NULL; i++)
1772 if (entry->
hash == hash)
1780 compare=hashmap_info->
compare(key,entry->
key);
1787 return((
void *) NULL);
1802 return((
void *) NULL);
1836 return((
void *) NULL);
1838 if (list_info->
next == list_info->
tail)
1852 next=list_info->
head;
1853 while (next->
next != list_info->
tail)
1856 list_info->
tail=next;
1892 hashmap_info->
next=0;
MagickExport MagickBooleanType IsLinkedListEmpty(const LinkedListInfo *list_info)
MagickExport int CompareStringInfo(const StringInfo *target, const StringInfo *source)
SemaphoreInfo * semaphore
MagickExport StringInfo * StringToStringInfo(const char *string)
struct _EntryInfo EntryInfo
MagickExport MagickBooleanType LinkedListToArray(LinkedListInfo *list_info, void **array)
MagickExport void UnlockSemaphoreInfo(SemaphoreInfo *semaphore_info)
MagickExport MagickBooleanType InsertValueInLinkedList(LinkedListInfo *list_info, const size_t index, const void *value)
#define ThrowFatalException(severity, tag)
void *(* relinquish_key)(void *)
MagickPrivate SignatureInfo * AcquireSignatureInfo(void)
MagickExport HashmapInfo * DestroyHashmap(HashmapInfo *hashmap_info)
MagickExport SemaphoreInfo * AcquireSemaphoreInfo(void)
MagickExport void * GetValueFromHashmap(HashmapInfo *hashmap_info, const void *key)
MagickExport void * GetNextValueInHashmap(HashmapInfo *hashmap_info)
MagickBooleanType(* compare)(const void *, const void *)
size_t(* hash)(const void *)
MagickExport void ResetLinkedListIterator(LinkedListInfo *list_info)
MagickExport void * RemoveEntryFromHashmap(HashmapInfo *hashmap_info, const void *key)
MagickExport void ResetHashmapIterator(HashmapInfo *hashmap_info)
MagickExport size_t HashPointerType(const void *pointer)
MagickExport MagickBooleanType InsertValueInSortedLinkedList(LinkedListInfo *list_info, int(*compare)(const void *, const void *), void **replace, const void *value)
MagickExport size_t HashStringType(const void *string)
MagickExport size_t GetNumberOfEntriesInHashmap(const HashmapInfo *hashmap_info)
#define MagickCoreSignature
MagickPrivate void FinalizeSignature(SignatureInfo *)
MagickExport void LockSemaphoreInfo(SemaphoreInfo *semaphore_info)
MagickExport LinkedListInfo * DestroyLinkedList(LinkedListInfo *list_info, void *(*relinquish_value)(void *))
MagickPrivate SignatureInfo * DestroySignatureInfo(SignatureInfo *)
MagickExport unsigned char * GetStringInfoDatum(const StringInfo *string_info)
MagickExport void ClearLinkedList(LinkedListInfo *list_info, void *(*relinquish_value)(void *))
SemaphoreInfo * semaphore
MagickExport void * RemoveElementFromLinkedList(LinkedListInfo *list_info, const size_t index)
MagickExport MagickBooleanType PutEntryInHashmap(HashmapInfo *hashmap_info, const void *key, const void *value)
MagickExport void * ResetMagickMemory(void *memory, int byte, const size_t size)
MagickExport StringInfo * DestroyStringInfo(StringInfo *string_info)
MagickExport MagickBooleanType IsHashmapEmpty(const HashmapInfo *hashmap_info)
MagickExport void * AcquireQuantumMemory(const size_t count, const size_t quantum)
struct _ElementInfo * next
MagickExport void * GetNextKeyInHashmap(HashmapInfo *hashmap_info)
MagickExport MagickBooleanType AppendValueToLinkedList(LinkedListInfo *list_info, const void *value)
MagickExport void * GetLastValueInLinkedList(LinkedListInfo *list_info)
MagickExport size_t HashStringInfoType(const void *string_info)
MagickExport void * GetNextValueInLinkedList(LinkedListInfo *list_info)
MagickPrivate void UpdateSignature(SignatureInfo *, const StringInfo *)
static MagickBooleanType IncreaseHashmapCapacity(HashmapInfo *hashmap_info)
MagickExport int LocaleCompare(const char *p, const char *q)
void *(*)*(* relinquish_value)(void *)
MagickExport size_t GetNumberOfElementsInLinkedList(const LinkedListInfo *list_info)
MagickExport MagickBooleanType CompareHashmapStringInfo(const void *target, const void *source)
MagickExport void * RemoveElementByValueFromLinkedList(LinkedListInfo *list_info, const void *value)
MagickExport void * AcquireMagickMemory(const size_t size)
MagickBooleanType head_of_list
MagickExport void * RemoveLastElementFromLinkedList(LinkedListInfo *list_info)
MagickExport void * RelinquishMagickMemory(void *memory)
MagickPrivate const StringInfo * GetSignatureDigest(const SignatureInfo *)
MagickExport HashmapInfo * NewHashmap(const size_t capacity, size_t(*hash)(const void *), MagickBooleanType(*compare)(const void *, const void *), void *(*relinquish_key)(void *), void *(*relinquish_value)(void *))
MagickExport LinkedListInfo * NewLinkedList(const size_t capacity)
MagickExport MagickBooleanType CompareHashmapString(const void *target, const void *source)
MagickExport void * GetValueFromLinkedList(LinkedListInfo *list_info, const size_t index)
MagickExport void RelinquishSemaphoreInfo(SemaphoreInfo **semaphore_info)
struct _ElementInfo ElementInfo