]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/hash.c
Add support for modeless channels
[ngircd-alex.git] / src / ngircd / hash.c
index dff84a67801f435de9484622cbf1964e257f553b..d9aa79bb1f1b93478a9f1dd7c0e135ac7ed62408 100644 (file)
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: hash.c,v 1.6 2002/12/12 12:24:18 alex Exp $";
+static char UNUSED id[] = "$Id: hash.c,v 1.13 2006/10/06 21:23:47 fw Exp $";
 
 #include "imp.h"
 #include <assert.h>
 #include <string.h>
 
 #include "defines.h"
-#include "log.h"
 #include "tool.h"
 
 #include "exp.h"
 #include "hash.h"
 
 
-LOCAL UINT32 jenkins_hash PARAMS(( register UINT8 *k, register UINT32 length, register UINT32 initval ));
+static UINT32 jenkins_hash PARAMS(( register UINT8 *k, register UINT32 length, register UINT32 initval ));
 
 
 GLOBAL UINT32
-Hash( CHAR *String )
+Hash( const char *String )
 {
        /* Hash-Wert ueber String berechnen */
 
-       CHAR buffer[LINE_LEN];
+       char buffer[LINE_LEN];
 
-       strncpy( buffer, String, LINE_LEN - 1 );
-       buffer[LINE_LEN - 1] = '\0';
-       
+       strlcpy( buffer, String, sizeof( buffer ));
        return jenkins_hash( (UINT8 *)ngt_LowerStr( buffer ), strlen( buffer ), 42 );
 } /* Hash */
 
@@ -75,7 +72,7 @@ Hash( CHAR *String )
 } /* mix */
 
 
-LOCAL UINT32
+static UINT32
 jenkins_hash( register UINT8 *k, register UINT32 length, register UINT32 initval )
 {
        /* k: the key
@@ -102,7 +99,7 @@ jenkins_hash( register UINT8 *k, register UINT32 length, register UINT32 initval
 
        /* handle the last 11 bytes */
        c += length;
-       switch(len)             /* all the case statements fall through */
+       switch( (int)len )      /* all the case statements fall through */
        {
                case 11: c+=((UINT32)k[10]<<24);
                case 10: c+=((UINT32)k[9]<<16);