Changeset 6efe1b78 in mainline


Ignore:
Timestamp:
2020-07-05T21:10:18Z (4 years ago)
Author:
Matthieu Riolo <matthieu.riolo@…>
Children:
b3c169e6
Parents:
0f75a63
git-author:
Matthieu Riolo <matthieu.riolo@…> (2020-04-13 20:52:27)
git-committer:
Matthieu Riolo <matthieu.riolo@…> (2020-07-05 21:10:18)
Message:

Removing recentely added hashing function

The function hash_string() implemented the
djb2 algorithm for hashing strings. As requested
during a review this has been changed to the
existing hashing function instead of implementing
a new one

Conflicts:

uspace/lib/c/include/adt/hash.h

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/adt/hash.h

    r0f75a63 r6efe1b78  
    111111}
    112112
     113/** Calculate hash of NULL-terminated string
     114 *
     115 * TODO Modify also same file in kernel subtree?
     116 *
     117 * @param[in]  str     NULL-terminated string
     118 * @return hash of the given string
     119 */
     120static inline size_t hash_string(const char *str)
     121{
     122        size_t hash = 0;
     123        if (str != NULL) {
     124                char c;
     125                while ((c = *str++) != 0) {
     126                        hash = hash_combine(hash, c);
     127                }
     128        }
     129
     130        return hash;
     131}
     132
    113133#endif
Note: See TracChangeset for help on using the changeset viewer.