On Wed, Oct 11, 2006 at 11:02:41AM +0200, Wojciech A. Koszek wrote: > Hello, > > I'm working on potential consumer of functions from sys/hash.h. Currently, I > can't make them work without modyfication in my sample KLD. This is a patch > which fixes the problem: > > http://people.freebsd.org/~wkoszek/patches/hash.h.0.patch > > It makes following program.. > > http://people.freebsd.org/~wkoszek/hash.c > > ..compile without warnings with WARNS=5. If noone objects, I'd like to > commit it. > This is a wrong fix. A correct fix would be:
%%% Index: sys/sys/hash.h =================================================================== RCS file: /home/ncvs/src/sys/sys/hash.h,v retrieving revision 1.2 diff -u -p -r1.2 hash.h --- sys/sys/hash.h 12 Mar 2006 15:34:33 -0000 1.2 +++ sys/sys/hash.h 11 Oct 2006 09:38:50 -0000 @@ -86,7 +86,7 @@ hash32_strn(const void *buf, size_t len, * namei() hashing of path name parts. */ static __inline uint32_t -hash32_stre(const void *buf, int end, char **ep, uint32_t hash) +hash32_stre(const void *buf, int end, const char **ep, uint32_t hash) { const unsigned char *p = buf; @@ -94,7 +94,7 @@ hash32_stre(const void *buf, int end, ch hash = HASHSTEP(hash, *p++); if (ep) - *ep = (char *)p; + *ep = (const char *)p; return hash; } @@ -105,7 +105,7 @@ hash32_stre(const void *buf, int end, ch * as a helper for the namei() hashing of path name parts. */ static __inline uint32_t -hash32_strne(const void *buf, size_t len, int end, char **ep, uint32_t hash) +hash32_strne(const void *buf, size_t len, int end, const char **ep, uint32_t hash) { const unsigned char *p = buf; @@ -113,7 +113,7 @@ hash32_strne(const void *buf, size_t len hash = HASHSTEP(hash, *p++); if (ep) - *ep = (char *)p; + *ep = (const char *)p; return hash; } Index: share/man/man9/hash.9 =================================================================== RCS file: /home/ncvs/src/share/man/man9/hash.9,v retrieving revision 1.2 diff -u -p -r1.2 hash.9 --- share/man/man9/hash.9 30 Sep 2006 17:09:59 -0000 1.2 +++ share/man/man9/hash.9 11 Oct 2006 09:39:43 -0000 @@ -47,9 +47,11 @@ .Ft uint32_t .Fn hash32_strn "void *buf" "size_t len" "uint32_t hash" .Ft uint32_t -.Fn hash32_stre "void *buf" "int end" "char **ep" "uint32_t hash" +.Fn hash32_stre "void *buf" "int end" "const char **ep" "uint32_t hash" .Ft uint32_t -.Fn hash32_strne "void *buf" "size_t len" "int end" "char **ep" "uint32_t hash" +.Fo hash32_strne +.Fa "void *buf" "size_t len" "int end" "const char **ep" "uint32_t hash" +.Fc .Sh DESCRIPTION The .Fn hash32 %%% Cheers, -- Ruslan Ermilov [EMAIL PROTECTED] FreeBSD committer
pgpoOe5Oxx40X.pgp
Description: PGP signature