1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-02 23:42:46 +03:00

Replace strncpy with strlcpy in selected places that seem possibly relevant

to performance.  (A wholesale effort to get rid of strncpy should be
undertaken sometime, but not during beta.)  This commit also fixes dynahash.c
to correctly truncate overlength string keys for hashtables, so that its
callers don't have to anymore.
This commit is contained in:
Tom Lane
2006-09-27 18:40:10 +00:00
parent 996b203e62
commit c92f7e258e
11 changed files with 72 additions and 73 deletions

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.89 2006/08/16 04:32:48 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/fmgr/dfmgr.c,v 1.90 2006/09/27 18:40:09 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -594,7 +594,6 @@ find_rendezvous_variable(const char *varName)
{
static HTAB *rendezvousHash = NULL;
char key[NAMEDATALEN];
rendezvousHashEntry *hentry;
bool found;
@@ -612,12 +611,9 @@ find_rendezvous_variable(const char *varName)
HASH_ELEM);
}
/* Turn the varName into a fixed-size string */
StrNCpy(key, varName, sizeof(key));
/* Find or create the hashtable entry for this varName */
hentry = (rendezvousHashEntry *) hash_search(rendezvousHash,
key,
varName,
HASH_ENTER,
&found);