aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/cache
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-06-05 07:29:25 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-06-05 07:29:25 +0000
commit48165ec2262b73c5b81a6caabab66d883d013a83 (patch)
tree08e878a2a1e7f76981406ac2b34729a510aecac6 /src/backend/utils/cache
parentc61db5ba2decf2e620f6ce3699d4b702957ed72a (diff)
downloadpostgresql-48165ec2262b73c5b81a6caabab66d883d013a83.tar.gz
postgresql-48165ec2262b73c5b81a6caabab66d883d013a83.zip
Latest round of fmgr updates. All functions with bool,char, or int2
inputs have been converted to newstyle. This should go a long way towards fixing our portability problems with platforms where char and short parameters are passed differently from int-width parameters. Still more to do for the Alpha port however.
Diffstat (limited to 'src/backend/utils/cache')
-rw-r--r--src/backend/utils/cache/catcache.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index e5fb546ca70..428110aa360 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.64 2000/05/28 17:56:06 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.65 2000/06/05 07:28:53 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -35,7 +35,7 @@ static Index CatalogCacheComputeTupleHashIndex(struct catcache * cacheInOutP,
HeapTuple tuple);
static void CatalogCacheInitializeCache(struct catcache * cache,
Relation relation);
-static uint32 cc_hashname(NameData *n);
+static Datum cc_hashname(PG_FUNCTION_ARGS);
/* ----------------
* variables, macros and other stuff
@@ -87,38 +87,38 @@ static const Oid eqproc[] = {
* ----------------------------------------------------------------
*/
-static CCHashFunc
+static PGFunction
GetCCHashFunc(Oid keytype)
{
switch (keytype)
{
- case BOOLOID:
- case CHAROID:
- return (CCHashFunc) hashchar;
+ case BOOLOID:
+ case CHAROID:
+ return hashchar;
case NAMEOID:
- return (CCHashFunc) cc_hashname;
+ return cc_hashname;
case INT2OID:
- return (CCHashFunc) hashint2;
+ return hashint2;
case INT2VECTOROID:
- return (CCHashFunc) hashint2vector;
+ return hashint2vector;
case INT4OID:
- return (CCHashFunc) hashint4;
+ return hashint4;
case TEXTOID:
- return (CCHashFunc) hashtext;
+ return hashtext;
case REGPROCOID:
case OIDOID:
- return (CCHashFunc) hashoid;
+ return hashoid;
case OIDVECTOROID:
- return (CCHashFunc) hashoidvector;
+ return hashoidvector;
default:
elog(FATAL, "GetCCHashFunc: type %u unsupported as catcache key",
keytype);
- return NULL;
+ return (PGFunction) NULL;
}
}
-static uint32
-cc_hashname(NameData *n)
+static Datum
+cc_hashname(PG_FUNCTION_ARGS)
{
/*
@@ -129,9 +129,9 @@ cc_hashname(NameData *n)
*/
NameData my_n;
- namestrcpy(&my_n, NameStr(*n));
+ namestrcpy(&my_n, NameStr(* PG_GETARG_NAME(0)));
- return hashname(&my_n);
+ return DirectFunctionCall1(hashname, NameGetDatum(&my_n));
}
@@ -320,19 +320,23 @@ CatalogCacheComputeHashIndex(struct catcache * cacheInP)
{
case 4:
hashIndex ^=
- (*cacheInP->cc_hashfunc[3]) (cacheInP->cc_skey[3].sk_argument) << 9;
+ DatumGetUInt32(DirectFunctionCall1(cacheInP->cc_hashfunc[3],
+ cacheInP->cc_skey[3].sk_argument)) << 9;
/* FALLTHROUGH */
case 3:
hashIndex ^=
- (*cacheInP->cc_hashfunc[2]) (cacheInP->cc_skey[2].sk_argument) << 6;
+ DatumGetUInt32(DirectFunctionCall1(cacheInP->cc_hashfunc[2],
+ cacheInP->cc_skey[2].sk_argument)) << 6;
/* FALLTHROUGH */
case 2:
hashIndex ^=
- (*cacheInP->cc_hashfunc[1]) (cacheInP->cc_skey[1].sk_argument) << 3;
+ DatumGetUInt32(DirectFunctionCall1(cacheInP->cc_hashfunc[1],
+ cacheInP->cc_skey[1].sk_argument)) << 3;
/* FALLTHROUGH */
case 1:
hashIndex ^=
- (*cacheInP->cc_hashfunc[0]) (cacheInP->cc_skey[0].sk_argument);
+ DatumGetUInt32(DirectFunctionCall1(cacheInP->cc_hashfunc[0],
+ cacheInP->cc_skey[0].sk_argument));
break;
default:
elog(FATAL, "CCComputeHashIndex: %d cc_nkeys", cacheInP->cc_nkeys);