]> granicus.if.org Git - postgresql/commitdiff
I had overlooked the fact that some fmgr-callable functions return void
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 14 Jun 2000 05:24:50 +0000 (05:24 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 14 Jun 2000 05:24:50 +0000 (05:24 +0000)
--- 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.

src/backend/access/gist/gist.c
src/backend/access/gist/gistscan.c
src/backend/access/hash/hash.c
src/backend/access/nbtree/nbtree.c
src/backend/access/rtree/rtproc.c
src/backend/access/rtree/rtree.c
src/backend/access/rtree/rtscan.c
src/backend/utils/adt/arrayfuncs.c
src/backend/utils/adt/selfuncs.c
src/include/fmgr.h

index 1d8c25104ceadb249e6f31c7a3b81640a21a1b21..e200942d502a6ca036ba3821ac1683d66760cf36 100644 (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
index 729837e800890c9aa3d664833901f954f37ef137..d37a8c077631bb941ba31447da9981c023db5ea5 100644 (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
index eec339f42dfc3b186b2ba25c4f1cb7f81873ad32..043e0b891bc6357a2b818ed68726d966726afca3 100644 (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();
 }
index ccd5a265d31f215d17f5fe882510e346e3dd9b9a..7dbc08fbfc88110c93caaad22f93db6ded069c45 100644 (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
index df410045c2df3a4da103ba2d26e2a29ac33688ef..f69e9977332862a900e829244fbea1d97166476d 100644 (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    *
index 358d307d0b5ed863b6eaabd5f740614e5136a177..513fcd8798b93c774cd660f5d337b8ae25b4b29c 100644 (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
index 97a71a00588a25b9b571a2cccf1e884a44c6c2fc..3cd6d3dae3fb178ae049c3426e8431d57eda5df9 100644 (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
index d54a6847bd259656144cde2523f20f505ff7d7a4..aae18aa047fc464691589be7b2911d844a43f847 100644 (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;
index 4d0af92ba2bc453e885bfe3e3b135bd96ea9a200..7ed17da41f34cde107d67ec37843473754bbcdf3 100644 (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();
 }
 
 /*
index cf5a3eb0cbf987343937ea8a8fb066c220841af6..c68abfcf85e3be5e4380486ce3f809bcf69dca2c 100644 (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)