Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Mar 1995 20:05:49 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        CVS-commiters@time.cdrom.com, cvs-lib@time.cdrom.com, jkh@freebsd.org
Subject:   Re: cvs commit: src/lib/libc/stdlib strhash.c
Message-ID:  <199503281005.UAA18620@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>  Modified:    lib/libc/stdlib strhash.c
>  Log:
>  Fix a missing _hash() to prevent namespace pollution with the db/hash routines.
>  Grrr.  If the dbhash routines weren't grossly overengineered I wouldn't
>  even need to do this! :-(

You never needed to rename hash() to _hash().  It is static so it doesn't
contribute to namespace pollution.  Adding a leading underscore just moves
it into the implementation's namespace and might cause problems if the
implementation uses it for some other purpose.  Since you control the
implementation, this is not much of a problem in practice.  In the current
implementation, you just have to check that there are no declarations for
globals named `_hash' in scope.

However, for debugging it is convenient to make even the names of internal
static objects and functions unique.  Names in the `foohash' module could
be distinguished from names in the `barhash' module by prefixing them with
`foo'.  `strhash' is a bad name for a module because names starting with
`str' are reserved.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199503281005.UAA18620>