1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-12 05:01:15 +03:00

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.
This commit is contained in:
Tom Lane
2000-06-05 07:29:25 +00:00
parent c61db5ba2d
commit 48165ec226
47 changed files with 2201 additions and 2034 deletions

View File

@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.68 2000/05/28 17:56:03 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.69 2000/06/05 07:28:45 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -174,7 +174,8 @@ inv_create(int flags)
if (!RelationIsValid(indr))
{
elog(ERROR, "cannot create index for large obj on %s under inversion",
smgrout(DEFAULT_SMGR));
DatumGetCString(DirectFunctionCall1(smgrout,
Int16GetDatum(DEFAULT_SMGR))));
}
retval = (LargeObjectDesc *) palloc(sizeof(LargeObjectDesc));

View File

@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.35 2000/04/12 17:15:42 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.36 2000/06/05 07:28:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -105,7 +105,9 @@ smgrinit()
if (smgrsw[i].smgr_init)
{
if ((*(smgrsw[i].smgr_init)) () == SM_FAIL)
elog(FATAL, "initialization failed on %s", smgrout(i));
elog(FATAL, "initialization failed on %s",
DatumGetCString(DirectFunctionCall1(smgrout,
Int16GetDatum(i))));
}
}
@@ -125,7 +127,9 @@ smgrshutdown(int dummy)
if (smgrsw[i].smgr_shutdown)
{
if ((*(smgrsw[i].smgr_shutdown)) () == SM_FAIL)
elog(FATAL, "shutdown failed on %s", smgrout(i));
elog(FATAL, "shutdown failed on %s",
DatumGetCString(DirectFunctionCall1(smgrout,
Int16GetDatum(i))));
}
}
}
@@ -445,7 +449,9 @@ smgrcommit()
if (smgrsw[i].smgr_commit)
{
if ((*(smgrsw[i].smgr_commit)) () == SM_FAIL)
elog(FATAL, "transaction commit failed on %s", smgrout(i));
elog(FATAL, "transaction commit failed on %s",
DatumGetCString(DirectFunctionCall1(smgrout,
Int16GetDatum(i))));
}
}
@@ -462,7 +468,9 @@ smgrabort()
if (smgrsw[i].smgr_abort)
{
if ((*(smgrsw[i].smgr_abort)) () == SM_FAIL)
elog(FATAL, "transaction abort failed on %s", smgrout(i));
elog(FATAL, "transaction abort failed on %s",
DatumGetCString(DirectFunctionCall1(smgrout,
Int16GetDatum(i))));
}
}

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgrtype.c,v 1.16 2000/01/26 05:57:05 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgrtype.c,v 1.17 2000/06/05 07:28:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -37,45 +37,48 @@ static smgrid StorageManager[] = {
static int NStorageManagers = lengthof(StorageManager);
int2
smgrin(char *s)
Datum
smgrin(PG_FUNCTION_ARGS)
{
int i;
char *s = PG_GETARG_CSTRING(0);
int16 i;
for (i = 0; i < NStorageManagers; i++)
{
if (strcmp(s, StorageManager[i].smgr_name) == 0)
return (int2) i;
PG_RETURN_INT16(i);
}
elog(ERROR, "smgrin: illegal storage manager name %s", s);
return 0;
elog(ERROR, "smgrin: unknown storage manager name '%s'", s);
PG_RETURN_INT16(0);
}
char *
smgrout(int2 i)
Datum
smgrout(PG_FUNCTION_ARGS)
{
int16 i = PG_GETARG_INT16(0);
char *s;
if (i >= NStorageManagers || i < 0)
elog(ERROR, "Illegal storage manager id %d", i);
s = (char *) palloc(strlen(StorageManager[i].smgr_name) + 1);
strcpy(s, StorageManager[i].smgr_name);
return s;
s = pstrdup(StorageManager[i].smgr_name);
PG_RETURN_CSTRING(s);
}
bool
smgreq(int2 a, int2 b)
Datum
smgreq(PG_FUNCTION_ARGS)
{
if (a == b)
return true;
return false;
int16 a = PG_GETARG_INT16(0);
int16 b = PG_GETARG_INT16(1);
PG_RETURN_BOOL(a == b);
}
bool
smgrne(int2 a, int2 b)
Datum
smgrne(PG_FUNCTION_ARGS)
{
if (a == b)
return false;
return true;
int16 a = PG_GETARG_INT16(0);
int16 b = PG_GETARG_INT16(1);
PG_RETURN_BOOL(a != b);
}