mirror of
https://github.com/postgres/postgres.git
synced 2025-11-12 05:01:15 +03:00
Third round of fmgr updates: eliminate calls using fmgr() and
fmgr_faddr() in favor of new-style calls. Lots of cleanup of sloppy casts to use XXXGetDatum and DatumGetXXX ...
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.53 2000/05/29 21:02:32 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.54 2000/05/30 04:24:50 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -441,7 +441,10 @@ _ReadArrayStr(char *arrayStr,
|
||||
*q = '\0';
|
||||
if (i >= nitems)
|
||||
elog(ERROR, "array_in: illformed array constant");
|
||||
values[i] = (*fmgr_faddr(inputproc)) (p, typelem, typmod);
|
||||
values[i] = (char *) FunctionCall3(inputproc,
|
||||
CStringGetDatum(p),
|
||||
ObjectIdGetDatum(typelem),
|
||||
Int32GetDatum(typmod));
|
||||
p = ++q;
|
||||
if (!eoArray)
|
||||
|
||||
@@ -669,21 +672,33 @@ array_out(ArrayType *v, Oid element_type)
|
||||
switch (typlen)
|
||||
{
|
||||
case 1:
|
||||
values[i] = (*fmgr_faddr(&outputproc)) (*p, typelem, -1);
|
||||
values[i] = DatumGetCString(FunctionCall3(&outputproc,
|
||||
CharGetDatum(*p),
|
||||
ObjectIdGetDatum(typelem),
|
||||
Int32GetDatum(-1)));
|
||||
break;
|
||||
case 2:
|
||||
values[i] = (*fmgr_faddr(&outputproc)) (*(int16 *) p, typelem, -1);
|
||||
values[i] = DatumGetCString(FunctionCall3(&outputproc,
|
||||
Int16GetDatum(*(int16 *) p),
|
||||
ObjectIdGetDatum(typelem),
|
||||
Int32GetDatum(-1)));
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
values[i] = (*fmgr_faddr(&outputproc)) (*(int32 *) p, typelem, -1);
|
||||
values[i] = DatumGetCString(FunctionCall3(&outputproc,
|
||||
Int32GetDatum(*(int32 *) p),
|
||||
ObjectIdGetDatum(typelem),
|
||||
Int32GetDatum(-1)));
|
||||
break;
|
||||
}
|
||||
p += typlen;
|
||||
}
|
||||
else
|
||||
{
|
||||
values[i] = (*fmgr_faddr(&outputproc)) (p, typelem, -1);
|
||||
values[i] = DatumGetCString(FunctionCall3(&outputproc,
|
||||
PointerGetDatum(p),
|
||||
ObjectIdGetDatum(typelem),
|
||||
Int32GetDatum(-1)));
|
||||
if (typlen > 0)
|
||||
p += typlen;
|
||||
else
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* out of its tuple
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.49 2000/05/30 00:49:53 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.50 2000/05/30 04:24:51 tgl Exp $
|
||||
*
|
||||
* This software is copyrighted by Jan Wieck - Hamburg.
|
||||
*
|
||||
@@ -1647,7 +1647,6 @@ get_const_expr(Const *constval, deparse_context *context)
|
||||
StringInfo buf = context->buf;
|
||||
HeapTuple typetup;
|
||||
Form_pg_type typeStruct;
|
||||
FmgrInfo finfo_output;
|
||||
char *extval;
|
||||
char *valptr;
|
||||
|
||||
@@ -1673,10 +1672,10 @@ get_const_expr(Const *constval, deparse_context *context)
|
||||
return;
|
||||
}
|
||||
|
||||
fmgr_info(typeStruct->typoutput, &finfo_output);
|
||||
extval = (char *) (*fmgr_faddr(&finfo_output)) (constval->constvalue,
|
||||
typeStruct->typelem,
|
||||
-1);
|
||||
extval = DatumGetCString(OidFunctionCall3(typeStruct->typoutput,
|
||||
constval->constvalue,
|
||||
ObjectIdGetDatum(typeStruct->typelem),
|
||||
Int32GetDatum(-1)));
|
||||
|
||||
switch (constval->consttype)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.67 2000/05/28 17:56:06 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.68 2000/05/30 04:24:51 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "catalog/pg_statistic.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "mb/pg_wchar.h"
|
||||
#include "optimizer/clauses.h"
|
||||
#include "optimizer/cost.h"
|
||||
#include "parser/parse_func.h"
|
||||
#include "parser/parse_oper.h"
|
||||
@@ -157,11 +158,13 @@ eqsel(Oid opid,
|
||||
|
||||
/* be careful to apply operator right way 'round */
|
||||
if (flag & SEL_RIGHT)
|
||||
mostcommon = (bool)
|
||||
DatumGetUInt8(fmgr(eqproc, commonval, value));
|
||||
mostcommon = DatumGetBool(OidFunctionCall2(eqproc,
|
||||
commonval,
|
||||
value));
|
||||
else
|
||||
mostcommon = (bool)
|
||||
DatumGetUInt8(fmgr(eqproc, value, commonval));
|
||||
mostcommon = DatumGetBool(OidFunctionCall2(eqproc,
|
||||
value,
|
||||
commonval));
|
||||
|
||||
if (mostcommon)
|
||||
{
|
||||
@@ -1278,8 +1281,10 @@ getattstatistics(Oid relid,
|
||||
{
|
||||
char *strval = textout(val);
|
||||
|
||||
*commonval = (Datum)
|
||||
(*fmgr_faddr(&inputproc)) (strval, typelem, typmod);
|
||||
*commonval = FunctionCall3(&inputproc,
|
||||
CStringGetDatum(strval),
|
||||
ObjectIdGetDatum(typelem),
|
||||
Int32GetDatum(typmod));
|
||||
pfree(strval);
|
||||
}
|
||||
}
|
||||
@@ -1287,7 +1292,7 @@ getattstatistics(Oid relid,
|
||||
if (loval)
|
||||
{
|
||||
text *val = (text *) SysCacheGetAttr(STATRELID, tuple,
|
||||
Anum_pg_statistic_staloval,
|
||||
Anum_pg_statistic_staloval,
|
||||
&isnull);
|
||||
|
||||
if (isnull)
|
||||
@@ -1299,8 +1304,10 @@ getattstatistics(Oid relid,
|
||||
{
|
||||
char *strval = textout(val);
|
||||
|
||||
*loval = (Datum)
|
||||
(*fmgr_faddr(&inputproc)) (strval, typelem, typmod);
|
||||
*loval = FunctionCall3(&inputproc,
|
||||
CStringGetDatum(strval),
|
||||
ObjectIdGetDatum(typelem),
|
||||
Int32GetDatum(typmod));
|
||||
pfree(strval);
|
||||
}
|
||||
}
|
||||
@@ -1320,8 +1327,10 @@ getattstatistics(Oid relid,
|
||||
{
|
||||
char *strval = textout(val);
|
||||
|
||||
*hival = (Datum)
|
||||
(*fmgr_faddr(&inputproc)) (strval, typelem, typmod);
|
||||
*hival = FunctionCall3(&inputproc,
|
||||
CStringGetDatum(strval),
|
||||
ObjectIdGetDatum(typelem),
|
||||
Int32GetDatum(typmod));
|
||||
pfree(strval);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user