I had overlooked the fact that some fmgr-callable functions return void

--- ie, they're only called for side-effects.  Add a PG_RETURN_VOID()
macro and use it where appropriate.  This probably doesn't change the
machine code by a single bit ... it's just for documentation.
This commit is contained in:
Tom Lane 2000-06-14 05:24:50 +00:00
parent 69cd08d9f7
commit ff7b9f5541
10 changed files with 41 additions and 43 deletions

View File

@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.56 2000/06/13 07:34:27 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.57 2000/06/14 05:24:35 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -303,7 +303,7 @@ gistbuild(PG_FUNCTION_ARGS)
pfree(nulls);
pfree(d);
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
/*
@ -1149,7 +1149,7 @@ gistdelete(PG_FUNCTION_ARGS)
WriteBuffer(buf);
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
void

View File

@ -154,7 +154,7 @@ gistrescan(PG_FUNCTION_ARGS)
}
}
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
Datum
@ -190,7 +190,7 @@ gistmarkpos(PG_FUNCTION_ARGS)
gistfreestack(p->s_markstk);
p->s_markstk = o;
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
Datum
@ -226,7 +226,7 @@ gistrestrpos(PG_FUNCTION_ARGS)
gistfreestack(p->s_stack);
p->s_stack = o;
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
Datum
@ -247,7 +247,7 @@ gistendscan(PG_FUNCTION_ARGS)
gistdropscan(s);
/* XXX don't unset read lock -- two-phase locking */
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
static void

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.38 2000/06/13 07:34:28 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.39 2000/06/14 05:24:35 tgl Exp $
*
* NOTES
* This file contains only the public interface routines.
@ -266,7 +266,7 @@ hashbuild(PG_FUNCTION_ARGS)
/* all done */
BuildingHash = false;
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
/*
@ -396,7 +396,7 @@ hashrescan(PG_FUNCTION_ARGS)
scan->numberOfKeys * sizeof(ScanKeyData));
}
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
/*
@ -433,7 +433,7 @@ hashendscan(PG_FUNCTION_ARGS)
/* be tidy */
pfree(scan->opaque);
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
/*
@ -466,7 +466,7 @@ hashmarkpos(PG_FUNCTION_ARGS)
scan->currentMarkData = scan->currentItemData;
}
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
/*
@ -499,7 +499,7 @@ hashrestrpos(PG_FUNCTION_ARGS)
scan->currentItemData = scan->currentMarkData;
}
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
/* stubs */
@ -515,5 +515,5 @@ hashdelete(PG_FUNCTION_ARGS)
/* delete the data from the page */
_hash_pagedel(rel, tid);
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}

View File

@ -12,7 +12,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.56 2000/06/13 07:34:38 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.57 2000/06/14 05:24:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -336,7 +336,7 @@ btbuild(PG_FUNCTION_ARGS)
/* all done */
BuildingBtree = false;
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
/*
@ -502,7 +502,7 @@ btrescan(PG_FUNCTION_ARGS)
so->numberOfKeys * sizeof(ScanKeyData));
}
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
void
@ -560,7 +560,7 @@ btendscan(PG_FUNCTION_ARGS)
_bt_dropscan(scan);
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
/*
@ -592,7 +592,7 @@ btmarkpos(PG_FUNCTION_ARGS)
so->mrkHeapIptr = so->curHeapIptr;
}
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
/*
@ -625,7 +625,7 @@ btrestrpos(PG_FUNCTION_ARGS)
so->curHeapIptr = so->mrkHeapIptr;
}
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
/* stubs */
@ -641,7 +641,7 @@ btdelete(PG_FUNCTION_ARGS)
/* delete the data from the page */
_bt_pagedel(rel, tid);
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
static void

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.26 2000/06/13 07:34:49 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.27 2000/06/14 05:24:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -18,8 +18,7 @@
#include "utils/builtins.h"
BOX
*
BOX *
rt_box_union(BOX *a, BOX *b)
{
BOX *n;
@ -123,7 +122,7 @@ rt_poly_size(PG_FUNCTION_ARGS)
*size = (float) (xdim * ydim);
}
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
POLYGON *

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.48 2000/06/13 07:34:49 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.49 2000/06/14 05:24:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -281,7 +281,7 @@ rtbuild(PG_FUNCTION_ARGS)
pfree(nulls);
pfree(d);
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
/*
@ -1025,7 +1025,7 @@ rtdelete(PG_FUNCTION_ARGS)
WriteBuffer(buf);
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
static void

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.33 2000/06/13 07:34:49 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtscan.c,v 1.34 2000/06/14 05:24:43 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -156,7 +156,7 @@ rtrescan(PG_FUNCTION_ARGS)
}
}
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
Datum
@ -192,7 +192,7 @@ rtmarkpos(PG_FUNCTION_ARGS)
freestack(p->s_markstk);
p->s_markstk = o;
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
Datum
@ -228,7 +228,7 @@ rtrestrpos(PG_FUNCTION_ARGS)
freestack(p->s_stack);
p->s_stack = o;
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
Datum
@ -249,7 +249,7 @@ rtendscan(PG_FUNCTION_ARGS)
rtdropscan(s);
/* XXX don't unset read lock -- two-phase locking */
PG_RETURN_POINTER(NULL); /* no real return value */
PG_RETURN_VOID();
}
static void

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.57 2000/06/13 07:35:03 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.58 2000/06/14 05:24:48 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -187,7 +187,7 @@ array_in(PG_FUNCTION_ARGS)
retval = (ArrayType *) palloc(sizeof(ArrayType));
MemSet(retval, 0, sizeof(ArrayType));
*(int32 *) retval = sizeof(ArrayType);
return PointerGetDatum(retval);
PG_RETURN_POINTER(retval);
}
if (*p == '{')
@ -238,7 +238,7 @@ array_in(PG_FUNCTION_ARGS)
PG_RETURN_NULL();
}
pfree(string_save);
return PointerGetDatum(retval);
PG_RETURN_POINTER(retval);
}
/*-----------------------------------------------------------------------------
@ -622,9 +622,6 @@ array_out(PG_FUNCTION_ARGS)
int ndim,
*dim;
if (v == (ArrayType *) NULL)
PG_RETURN_CSTRING((char *) NULL);
if (ARR_IS_LO(v) == true)
{
text *p;

View File

@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.70 2000/06/09 01:11:09 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.71 2000/06/14 05:24:49 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -1934,8 +1934,7 @@ genericcostestimate(PG_FUNCTION_ARGS)
*indexTotalCost = numIndexPages +
(cpu_index_tuple_cost + cost_qual_eval(indexQuals)) * numIndexTuples;
/* No real return value ... */
PG_RETURN_POINTER(NULL);
PG_RETURN_VOID();
}
/*

View File

@ -11,7 +11,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: fmgr.h,v 1.5 2000/06/13 07:35:23 tgl Exp $
* $Id: fmgr.h,v 1.6 2000/06/14 05:24:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -147,6 +147,9 @@ extern void fmgr_info(Oid functionId, FmgrInfo *finfo);
#define PG_RETURN_NULL() \
do { fcinfo->isnull = true; return (Datum) 0; } while (0)
/* A few internal functions return void (which is not the same as NULL!) */
#define PG_RETURN_VOID() return (Datum) 0
/* Macros for returning results of standard types */
#define PG_RETURN_INT32(x) return Int32GetDatum(x)