mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
smbd: Move fast_string_hash() to mangle_hash.c, the only user
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
5ce8b395ec
commit
6c64e698f0
@ -1099,6 +1099,22 @@ static const struct mangle_fns mangle_hash_fns = {
|
||||
hash_name_to_8_3
|
||||
};
|
||||
|
||||
/***************************************************************
|
||||
Compute a hash value based on a string key value.
|
||||
The function returns the bucket index number for the hashed key.
|
||||
JRA. Use a djb-algorithm hash for speed.
|
||||
***************************************************************/
|
||||
|
||||
static unsigned int fast_string_hash(TDB_DATA *key)
|
||||
{
|
||||
unsigned int n = 0;
|
||||
const char *p;
|
||||
for (p = (const char *)key->dptr; *p != '\0'; p++) {
|
||||
n = ((n << 5) + n) ^ (unsigned int)(*p);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
/* return the methods for this mangling implementation */
|
||||
const struct mangle_fns *mangle_hash_init(void)
|
||||
{
|
||||
|
@ -1176,7 +1176,6 @@ void send_stat_cache_delete_message(struct messaging_context *msg_ctx,
|
||||
const char *name);
|
||||
void stat_cache_delete(const char *name);
|
||||
struct TDB_DATA;
|
||||
unsigned int fast_string_hash(struct TDB_DATA *key);
|
||||
bool reset_stat_cache( void );
|
||||
|
||||
/* The following definitions come from smbd/statvfs.c */
|
||||
|
@ -433,22 +433,6 @@ void stat_cache_delete(const char *name)
|
||||
TALLOC_FREE(lname);
|
||||
}
|
||||
|
||||
/***************************************************************
|
||||
Compute a hash value based on a string key value.
|
||||
The function returns the bucket index number for the hashed key.
|
||||
JRA. Use a djb-algorithm hash for speed.
|
||||
***************************************************************/
|
||||
|
||||
unsigned int fast_string_hash(TDB_DATA *key)
|
||||
{
|
||||
unsigned int n = 0;
|
||||
const char *p;
|
||||
for (p = (const char *)key->dptr; *p != '\0'; p++) {
|
||||
n = ((n << 5) + n) ^ (unsigned int)(*p);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
Initializes or clears the stat cache.
|
||||
**************************************************************************/
|
||||
|
Loading…
x
Reference in New Issue
Block a user