Minor code cleanup: hdefault() only ever returned "true", so it may as
well be declared to return "void" to save callers the trouble of checking for errors.
This commit is contained in:
parent
a57df8d50d
commit
121aca39ba
@ -9,7 +9,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/hash/dynahash.c,v 1.54 2004/09/28 20:46:34 tgl Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/hash/dynahash.c,v 1.55 2004/10/22 07:21:06 neilc Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -66,7 +66,7 @@ static HASHSEGMENT seg_alloc(HTAB *hashp);
|
|||||||
static bool element_alloc(HTAB *hashp, int nelem);
|
static bool element_alloc(HTAB *hashp, int nelem);
|
||||||
static bool dir_realloc(HTAB *hashp);
|
static bool dir_realloc(HTAB *hashp);
|
||||||
static bool expand_table(HTAB *hashp);
|
static bool expand_table(HTAB *hashp);
|
||||||
static bool hdefault(HTAB *hashp);
|
static void hdefault(HTAB *hashp);
|
||||||
static bool init_htab(HTAB *hashp, long nelem);
|
static bool init_htab(HTAB *hashp, long nelem);
|
||||||
static void hash_corrupted(HTAB *hashp);
|
static void hash_corrupted(HTAB *hashp);
|
||||||
|
|
||||||
@ -178,8 +178,7 @@ hash_create(const char *tabname, long nelem, HASHCTL *info, int flags)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hdefault(hashp))
|
hdefault(hashp);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
hctl = hashp->hctl;
|
hctl = hashp->hctl;
|
||||||
#ifdef HASH_STATISTICS
|
#ifdef HASH_STATISTICS
|
||||||
@ -254,7 +253,7 @@ hash_create(const char *tabname, long nelem, HASHCTL *info, int flags)
|
|||||||
/*
|
/*
|
||||||
* Set default HASHHDR parameters.
|
* Set default HASHHDR parameters.
|
||||||
*/
|
*/
|
||||||
static bool
|
static void
|
||||||
hdefault(HTAB *hashp)
|
hdefault(HTAB *hashp)
|
||||||
{
|
{
|
||||||
HASHHDR *hctl = hashp->hctl;
|
HASHHDR *hctl = hashp->hctl;
|
||||||
@ -268,8 +267,6 @@ hdefault(HTAB *hashp)
|
|||||||
hctl->nentries = 0;
|
hctl->nentries = 0;
|
||||||
hctl->nsegs = 0;
|
hctl->nsegs = 0;
|
||||||
|
|
||||||
/* I added these MS. */
|
|
||||||
|
|
||||||
/* rather pointless defaults for key & entry size */
|
/* rather pointless defaults for key & entry size */
|
||||||
hctl->keysize = sizeof(char *);
|
hctl->keysize = sizeof(char *);
|
||||||
hctl->entrysize = 2 * sizeof(char *);
|
hctl->entrysize = 2 * sizeof(char *);
|
||||||
@ -279,8 +276,6 @@ hdefault(HTAB *hashp)
|
|||||||
|
|
||||||
/* garbage collection for HASH_REMOVE */
|
/* garbage collection for HASH_REMOVE */
|
||||||
hctl->freeList = NULL;
|
hctl->freeList = NULL;
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user