summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/util')
-rw-r--r--src/lib/util/tagmap.c14
-rw-r--r--src/lib/util/tagmap.h12
2 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/util/tagmap.c b/src/lib/util/tagmap.c
index 6cd9ddad601..a7f93f186b1 100644
--- a/src/lib/util/tagmap.c
+++ b/src/lib/util/tagmap.c
@@ -66,7 +66,7 @@ tagmap *tagmap_alloc(void)
/*-------------------------------------------------
- tagmap_free - free a tagmap, and all
+ tagmap_free - free a tagmap, and all
entries within it
-------------------------------------------------*/
@@ -78,14 +78,14 @@ void tagmap_free(tagmap *map)
/*-------------------------------------------------
- tagmap_reset - reset a tagmap by freeing
+ tagmap_reset - reset a tagmap by freeing
all entries
-------------------------------------------------*/
void tagmap_reset(tagmap *map)
{
UINT32 hashindex;
-
+
for (hashindex = 0; hashindex < ARRAY_LENGTH(map->table); hashindex++)
{
tagmap_entry *entry, *next;
@@ -116,7 +116,7 @@ tagmap_error tagmap_add(tagmap *map, const char *tag, void *object)
/*-------------------------------------------------
- tagmap_add_unique_hash - add a new entry to a
+ tagmap_add_unique_hash - add a new entry to a
tagmap, ensuring it has a unique hash value
-------------------------------------------------*/
@@ -135,7 +135,7 @@ void tagmap_remove(tagmap *map, const char *tag)
{
UINT32 fullhash = tagmap_hash(tag);
tagmap_entry **entryptr;
-
+
for (entryptr = &map->table[fullhash % ARRAY_LENGTH(map->table)]; *entryptr != NULL; entryptr = &(*entryptr)->next)
if ((*entryptr)->fullhash == fullhash && strcmp((*entryptr)->tag, tag) == 0)
{
@@ -170,7 +170,7 @@ static tagmap_error tagmap_add_common(tagmap *map, const char *tag, void *object
/* if we require a unique hash, fail here */
if (unique_hash)
return TMERR_DUPLICATE;
-
+
/* validate the string */
if (strcmp(tag, entry->tag) == 0)
return TMERR_DUPLICATE;
@@ -180,7 +180,7 @@ static tagmap_error tagmap_add_common(tagmap *map, const char *tag, void *object
entry = malloc(sizeof(*entry) + strlen(tag));
if (entry == NULL)
return TMERR_OUT_OF_MEMORY;
-
+
/* fill in the entry */
entry->object = object;
entry->fullhash = fullhash;
diff --git a/src/lib/util/tagmap.h b/src/lib/util/tagmap.h
index d1de47de60d..4489be70f4b 100644
--- a/src/lib/util/tagmap.h
+++ b/src/lib/util/tagmap.h
@@ -127,7 +127,7 @@ INLINE UINT32 tagmap_hash(const char *string)
{
UINT32 hash = (string[0] << 5) + string[1];
char c;
-
+
string += 2;
while ((c = *string++) != 0)
hash = ((hash << 5) | (hash >> 27)) + c;
@@ -136,7 +136,7 @@ INLINE UINT32 tagmap_hash(const char *string)
/*-------------------------------------------------
- tagmap_find_prehashed - find an object
+ tagmap_find_prehashed - find an object
associated with a tag, given the tag's
hash
-------------------------------------------------*/
@@ -144,7 +144,7 @@ INLINE UINT32 tagmap_hash(const char *string)
INLINE void *tagmap_find_prehashed(tagmap *map, const char *tag, UINT32 fullhash)
{
tagmap_entry *entry;
-
+
for (entry = map->table[fullhash % ARRAY_LENGTH(map->table)]; entry != NULL; entry = entry->next)
if (entry->fullhash == fullhash && strcmp(entry->tag, tag) == 0)
return entry->object;
@@ -153,7 +153,7 @@ INLINE void *tagmap_find_prehashed(tagmap *map, const char *tag, UINT32 fullhash
/*-------------------------------------------------
- tagmap_find - find an object associated
+ tagmap_find - find an object associated
with a tag
-------------------------------------------------*/
@@ -164,7 +164,7 @@ INLINE void *tagmap_find(tagmap *map, const char *tag)
/*-------------------------------------------------
- tagmap_find_hash_only - find an object
+ tagmap_find_hash_only - find an object
associated with a tag using only the hash;
this generally works well but may occasionally
return a false positive
@@ -174,7 +174,7 @@ INLINE void *tagmap_find_hash_only(tagmap *map, const char *tag)
{
UINT32 fullhash = tagmap_hash(tag);
tagmap_entry *entry;
-
+
for (entry = map->table[fullhash % ARRAY_LENGTH(map->table)]; entry != NULL; entry = entry->next)
if (entry->fullhash == fullhash)
return entry->object;