pgindent run for 8.3.
authorBruce Momjian <bruce@momjian.us>
Thu, 15 Nov 2007 21:14:46 +0000 (21:14 +0000)
committerBruce Momjian <bruce@momjian.us>
Thu, 15 Nov 2007 21:14:46 +0000 (21:14 +0000)
486 files changed:
contrib/cube/cube.c
contrib/dblink/dblink.c
contrib/dict_int/dict_int.c
contrib/dict_xsyn/dict_xsyn.c
contrib/hstore/hstore.h
contrib/hstore/hstore_gin.c
contrib/hstore/hstore_op.c
contrib/intarray/_int_gin.c
contrib/intarray/_int_gist.c
contrib/isn/isn.c
contrib/pageinspect/btreefuncs.c
contrib/pageinspect/heapfuncs.c
contrib/pageinspect/rawpage.c
contrib/pg_buffercache/pg_buffercache_pages.c
contrib/pg_standby/pg_standby.c
contrib/pg_trgm/trgm_gin.c
contrib/pgbench/pgbench.c
contrib/pgcrypto/blf.c
contrib/pgcrypto/blf.h
contrib/pgcrypto/crypt-blowfish.c
contrib/pgcrypto/imath.h
contrib/pgcrypto/internal.c
contrib/pgcrypto/openssl.c
contrib/pgcrypto/pgp-compress.c
contrib/pgcrypto/px.c
contrib/pgcrypto/sha2.c
contrib/pgstattuple/pgstatindex.c
contrib/tablefunc/tablefunc.c
contrib/test_parser/test_parser.c
contrib/tsearch2/tsearch2.c
contrib/uuid-ossp/uuid-ossp.c
src/backend/access/common/heaptuple.c
src/backend/access/common/indextuple.c
src/backend/access/common/reloptions.c
src/backend/access/gin/ginarrayproc.c
src/backend/access/gin/ginbtree.c
src/backend/access/gin/gindatapage.c
src/backend/access/gin/ginentrypage.c
src/backend/access/gin/ginget.c
src/backend/access/gin/ginscan.c
src/backend/access/gin/ginutil.c
src/backend/access/gin/ginvacuum.c
src/backend/access/gin/ginxlog.c
src/backend/access/gist/gist.c
src/backend/access/gist/gistget.c
src/backend/access/gist/gistproc.c
src/backend/access/gist/gistvacuum.c
src/backend/access/hash/hash.c
src/backend/access/hash/hashfunc.c
src/backend/access/hash/hashovfl.c
src/backend/access/hash/hashpage.c
src/backend/access/heap/heapam.c
src/backend/access/heap/pruneheap.c
src/backend/access/heap/rewriteheap.c
src/backend/access/heap/syncscan.c
src/backend/access/heap/tuptoaster.c
src/backend/access/index/indexam.c
src/backend/access/nbtree/nbtinsert.c
src/backend/access/nbtree/nbtpage.c
src/backend/access/nbtree/nbtsearch.c
src/backend/access/nbtree/nbtutils.c
src/backend/access/nbtree/nbtxlog.c
src/backend/access/transam/clog.c
src/backend/access/transam/multixact.c
src/backend/access/transam/transam.c
src/backend/access/transam/twophase.c
src/backend/access/transam/twophase_rmgr.c
src/backend/access/transam/varsup.c
src/backend/access/transam/xact.c
src/backend/access/transam/xlog.c
src/backend/bootstrap/bootstrap.c
src/backend/catalog/aclchk.c
src/backend/catalog/dependency.c
src/backend/catalog/heap.c
src/backend/catalog/index.c
src/backend/catalog/namespace.c
src/backend/catalog/pg_aggregate.c
src/backend/catalog/pg_constraint.c
src/backend/catalog/pg_conversion.c
src/backend/catalog/pg_enum.c
src/backend/catalog/pg_operator.c
src/backend/catalog/pg_proc.c
src/backend/catalog/pg_shdepend.c
src/backend/catalog/pg_type.c
src/backend/commands/analyze.c
src/backend/commands/cluster.c
src/backend/commands/comment.c
src/backend/commands/copy.c
src/backend/commands/dbcommands.c
src/backend/commands/discard.c
src/backend/commands/explain.c
src/backend/commands/functioncmds.c
src/backend/commands/indexcmds.c
src/backend/commands/opclasscmds.c
src/backend/commands/operatorcmds.c
src/backend/commands/portalcmds.c
src/backend/commands/prepare.c
src/backend/commands/schemacmds.c
src/backend/commands/sequence.c
src/backend/commands/tablecmds.c
src/backend/commands/tablespace.c
src/backend/commands/tsearchcmds.c
src/backend/commands/typecmds.c
src/backend/commands/vacuum.c
src/backend/commands/vacuumlazy.c
src/backend/commands/variable.c
src/backend/commands/view.c
src/backend/executor/execAmi.c
src/backend/executor/execCurrent.c
src/backend/executor/execMain.c
src/backend/executor/execQual.c
src/backend/executor/execScan.c
src/backend/executor/execUtils.c
src/backend/executor/functions.c
src/backend/executor/nodeAgg.c
src/backend/executor/nodeBitmapHeapscan.c
src/backend/executor/nodeBitmapIndexscan.c
src/backend/executor/nodeHash.c
src/backend/executor/nodeHashjoin.c
src/backend/executor/nodeIndexscan.c
src/backend/executor/nodeLimit.c
src/backend/executor/nodeMaterial.c
src/backend/executor/nodeMergejoin.c
src/backend/executor/nodeResult.c
src/backend/executor/nodeSubplan.c
src/backend/executor/nodeSubqueryscan.c
src/backend/executor/nodeTidscan.c
src/backend/executor/spi.c
src/backend/lib/stringinfo.c
src/backend/libpq/auth.c
src/backend/libpq/be-secure.c
src/backend/libpq/hba.c
src/backend/libpq/ip.c
src/backend/libpq/pqcomm.c
src/backend/libpq/pqformat.c
src/backend/main/main.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/nodes/outfuncs.c
src/backend/nodes/print.c
src/backend/optimizer/geqo/geqo_eval.c
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/path/costsize.c
src/backend/optimizer/path/equivclass.c
src/backend/optimizer/path/indxpath.c
src/backend/optimizer/path/joinpath.c
src/backend/optimizer/path/joinrels.c
src/backend/optimizer/path/pathkeys.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/initsplan.c
src/backend/optimizer/plan/planagg.c
src/backend/optimizer/plan/planmain.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/plan/setrefs.c
src/backend/optimizer/plan/subselect.c
src/backend/optimizer/prep/prepunion.c
src/backend/optimizer/util/clauses.c
src/backend/optimizer/util/joininfo.c
src/backend/optimizer/util/pathnode.c
src/backend/optimizer/util/plancat.c
src/backend/optimizer/util/predtest.c
src/backend/optimizer/util/relnode.c
src/backend/optimizer/util/restrictinfo.c
src/backend/optimizer/util/tlist.c
src/backend/optimizer/util/var.c
src/backend/parser/analyze.c
src/backend/parser/keywords.c
src/backend/parser/parse_clause.c
src/backend/parser/parse_coerce.c
src/backend/parser/parse_expr.c
src/backend/parser/parse_func.c
src/backend/parser/parse_oper.c
src/backend/parser/parse_target.c
src/backend/parser/parse_type.c
src/backend/parser/parse_utilcmd.c
src/backend/parser/parser.c
src/backend/port/dynloader/darwin.c
src/backend/port/sysv_shmem.c
src/backend/port/win32/mingwcompat.c
src/backend/port/win32/socket.c
src/backend/postmaster/autovacuum.c
src/backend/postmaster/bgwriter.c
src/backend/postmaster/pgarch.c
src/backend/postmaster/pgstat.c
src/backend/postmaster/postmaster.c
src/backend/postmaster/syslogger.c
src/backend/postmaster/walwriter.c
src/backend/regex/regc_color.c
src/backend/rewrite/rewriteDefine.c
src/backend/rewrite/rewriteManip.c
src/backend/snowball/dict_snowball.c
src/backend/storage/buffer/bufmgr.c
src/backend/storage/buffer/freelist.c
src/backend/storage/buffer/localbuf.c
src/backend/storage/file/fd.c
src/backend/storage/ipc/ipc.c
src/backend/storage/ipc/ipci.c
src/backend/storage/ipc/procarray.c
src/backend/storage/ipc/sinvaladt.c
src/backend/storage/large_object/inv_api.c
src/backend/storage/lmgr/deadlock.c
src/backend/storage/lmgr/lmgr.c
src/backend/storage/lmgr/lock.c
src/backend/storage/lmgr/lwlock.c
src/backend/storage/lmgr/proc.c
src/backend/storage/page/bufpage.c
src/backend/storage/smgr/md.c
src/backend/storage/smgr/smgr.c
src/backend/tcop/postgres.c
src/backend/tcop/pquery.c
src/backend/tcop/utility.c
src/backend/tsearch/dict.c
src/backend/tsearch/dict_ispell.c
src/backend/tsearch/dict_simple.c
src/backend/tsearch/dict_synonym.c
src/backend/tsearch/dict_thesaurus.c
src/backend/tsearch/spell.c
src/backend/tsearch/to_tsany.c
src/backend/tsearch/ts_locale.c
src/backend/tsearch/ts_parse.c
src/backend/tsearch/ts_utils.c
src/backend/tsearch/wparser.c
src/backend/tsearch/wparser_def.c
src/backend/utils/adt/arrayutils.c
src/backend/utils/adt/bool.c
src/backend/utils/adt/cash.c
src/backend/utils/adt/date.c
src/backend/utils/adt/datetime.c
src/backend/utils/adt/dbsize.c
src/backend/utils/adt/enum.c
src/backend/utils/adt/float.c
src/backend/utils/adt/format_type.c
src/backend/utils/adt/formatting.c
src/backend/utils/adt/geo_ops.c
src/backend/utils/adt/like.c
src/backend/utils/adt/like_match.c
src/backend/utils/adt/lockfuncs.c
src/backend/utils/adt/network.c
src/backend/utils/adt/numeric.c
src/backend/utils/adt/oracle_compat.c
src/backend/utils/adt/pg_lzcompress.c
src/backend/utils/adt/pgstatfuncs.c
src/backend/utils/adt/regexp.c
src/backend/utils/adt/regproc.c
src/backend/utils/adt/ri_triggers.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/adt/selfuncs.c
src/backend/utils/adt/timestamp.c
src/backend/utils/adt/tsginidx.c
src/backend/utils/adt/tsquery.c
src/backend/utils/adt/tsquery_cleanup.c
src/backend/utils/adt/tsquery_gist.c
src/backend/utils/adt/tsquery_rewrite.c
src/backend/utils/adt/tsquery_util.c
src/backend/utils/adt/tsrank.c
src/backend/utils/adt/tsvector.c
src/backend/utils/adt/tsvector_parser.c
src/backend/utils/adt/txid.c
src/backend/utils/adt/uuid.c
src/backend/utils/adt/varbit.c
src/backend/utils/adt/varchar.c
src/backend/utils/adt/varlena.c
src/backend/utils/adt/xml.c
src/backend/utils/cache/catcache.c
src/backend/utils/cache/inval.c
src/backend/utils/cache/lsyscache.c
src/backend/utils/cache/plancache.c
src/backend/utils/cache/relcache.c
src/backend/utils/cache/ts_cache.c
src/backend/utils/cache/typcache.c
src/backend/utils/error/elog.c
src/backend/utils/fmgr/fmgr.c
src/backend/utils/hash/dynahash.c
src/backend/utils/init/flatfiles.c
src/backend/utils/init/globals.c
src/backend/utils/init/postinit.c
src/backend/utils/mb/conversion_procs/euc_jis_2004_and_shift_jis_2004/euc_jis_2004_and_shift_jis_2004.c
src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c
src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c
src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c
src/backend/utils/mb/conversion_procs/utf8_and_euc_jis_2004/utf8_and_euc_jis_2004.c
src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c
src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c
src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c
src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c
src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c
src/backend/utils/mb/conversion_procs/utf8_and_shift_jis_2004/utf8_and_shift_jis_2004.c
src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c
src/backend/utils/mb/encnames.c
src/backend/utils/mb/mbutils.c
src/backend/utils/mb/wchar.c
src/backend/utils/misc/guc.c
src/backend/utils/misc/ps_status.c
src/backend/utils/mmgr/aset.c
src/backend/utils/mmgr/portalmem.c
src/backend/utils/resowner/resowner.c
src/backend/utils/sort/tuplesort.c
src/backend/utils/sort/tuplestore.c
src/backend/utils/time/combocid.c
src/backend/utils/time/tqual.c
src/bin/initdb/initdb.c
src/bin/pg_ctl/pg_ctl.c
src/bin/pg_dump/common.c
src/bin/pg_dump/dumputils.c
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_backup_tar.c
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.h
src/bin/pg_dump/pg_dumpall.c
src/bin/pg_resetxlog/pg_resetxlog.c
src/bin/psql/command.c
src/bin/psql/common.c
src/bin/psql/copy.c
src/bin/psql/describe.c
src/bin/psql/help.c
src/bin/psql/tab-complete.c
src/bin/scripts/common.c
src/bin/scripts/common.h
src/include/access/genam.h
src/include/access/gin.h
src/include/access/hash.h
src/include/access/heapam.h
src/include/access/htup.h
src/include/access/nbtree.h
src/include/access/relscan.h
src/include/access/rewriteheap.h
src/include/access/slru.h
src/include/access/transam.h
src/include/access/tupmacs.h
src/include/access/tuptoaster.h
src/include/access/xact.h
src/include/access/xlog.h
src/include/bootstrap/bootstrap.h
src/include/catalog/dependency.h
src/include/catalog/indexing.h
src/include/catalog/namespace.h
src/include/catalog/pg_am.h
src/include/catalog/pg_amop.h
src/include/catalog/pg_amproc.h
src/include/catalog/pg_autovacuum.h
src/include/catalog/pg_cast.h
src/include/catalog/pg_class.h
src/include/catalog/pg_database.h
src/include/catalog/pg_enum.h
src/include/catalog/pg_opclass.h
src/include/catalog/pg_operator.h
src/include/catalog/pg_proc.h
src/include/catalog/pg_trigger.h
src/include/catalog/pg_ts_config.h
src/include/catalog/pg_ts_config_map.h
src/include/catalog/pg_ts_dict.h
src/include/catalog/pg_ts_parser.h
src/include/catalog/pg_ts_template.h
src/include/catalog/pg_type.h
src/include/commands/defrem.h
src/include/commands/discard.h
src/include/commands/explain.h
src/include/commands/portalcmds.h
src/include/commands/prepare.h
src/include/commands/schemacmds.h
src/include/commands/tablecmds.h
src/include/commands/trigger.h
src/include/commands/typecmds.h
src/include/commands/vacuum.h
src/include/commands/variable.h
src/include/executor/execdesc.h
src/include/executor/executor.h
src/include/executor/spi.h
src/include/executor/spi_priv.h
src/include/fmgr.h
src/include/libpq/libpq-be.h
src/include/libpq/pqcomm.h
src/include/mb/pg_wchar.h
src/include/miscadmin.h
src/include/nodes/execnodes.h
src/include/nodes/params.h
src/include/nodes/parsenodes.h
src/include/nodes/plannodes.h
src/include/nodes/primnodes.h
src/include/nodes/relation.h
src/include/optimizer/joininfo.h
src/include/optimizer/paths.h
src/include/optimizer/plancat.h
src/include/optimizer/planmain.h
src/include/optimizer/planner.h
src/include/optimizer/tlist.h
src/include/parser/parse_coerce.h
src/include/parser/parse_type.h
src/include/parser/parse_utilcmd.h
src/include/pgstat.h
src/include/port.h
src/include/port/linux.h
src/include/port/solaris.h
src/include/port/win32.h
src/include/postgres.h
src/include/postmaster/autovacuum.h
src/include/postmaster/syslogger.h
src/include/rewrite/rewriteDefine.h
src/include/snowball/header.h
src/include/storage/buf_internals.h
src/include/storage/bufmgr.h
src/include/storage/bufpage.h
src/include/storage/itemid.h
src/include/storage/large_object.h
src/include/storage/lock.h
src/include/storage/pmsignal.h
src/include/storage/proc.h
src/include/storage/procarray.h
src/include/storage/sinvaladt.h
src/include/storage/smgr.h
src/include/tcop/tcopprot.h
src/include/tcop/utility.h
src/include/tsearch/dicts/regis.h
src/include/tsearch/dicts/spell.h
src/include/tsearch/ts_cache.h
src/include/tsearch/ts_locale.h
src/include/tsearch/ts_public.h
src/include/tsearch/ts_type.h
src/include/tsearch/ts_utils.h
src/include/utils/builtins.h
src/include/utils/elog.h
src/include/utils/guc.h
src/include/utils/guc_tables.h
src/include/utils/inet.h
src/include/utils/lsyscache.h
src/include/utils/pg_lzcompress.h
src/include/utils/plancache.h
src/include/utils/portal.h
src/include/utils/rel.h
src/include/utils/resowner.h
src/include/utils/timestamp.h
src/include/utils/tqual.h
src/include/utils/typcache.h
src/include/utils/uuid.h
src/include/utils/xml.h
src/interfaces/ecpg/compatlib/informix.c
src/interfaces/ecpg/ecpglib/connect.c
src/interfaces/ecpg/ecpglib/data.c
src/interfaces/ecpg/ecpglib/descriptor.c
src/interfaces/ecpg/ecpglib/error.c
src/interfaces/ecpg/ecpglib/execute.c
src/interfaces/ecpg/ecpglib/extern.h
src/interfaces/ecpg/ecpglib/memory.c
src/interfaces/ecpg/ecpglib/misc.c
src/interfaces/ecpg/ecpglib/prepare.c
src/interfaces/ecpg/ecpglib/typename.c
src/interfaces/ecpg/include/ecpg-pthread-win32.h
src/interfaces/ecpg/pgtypeslib/datetime.c
src/interfaces/ecpg/pgtypeslib/dt.h
src/interfaces/ecpg/pgtypeslib/dt_common.c
src/interfaces/ecpg/preproc/ecpg.c
src/interfaces/ecpg/preproc/ecpg_keywords.c
src/interfaces/ecpg/preproc/extern.h
src/interfaces/ecpg/preproc/keywords.c
src/interfaces/ecpg/preproc/output.c
src/interfaces/ecpg/preproc/parser.c
src/interfaces/ecpg/preproc/type.c
src/interfaces/ecpg/preproc/type.h
src/interfaces/ecpg/test/pg_regress_ecpg.c
src/interfaces/libpq/fe-auth.c
src/interfaces/libpq/fe-auth.h
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-lobj.c
src/interfaces/libpq/fe-secure.c
src/interfaces/libpq/libpq-int.h
src/pl/plperl/plperl.c
src/pl/plpgsql/src/pl_comp.c
src/pl/plpgsql/src/pl_exec.c
src/pl/plpgsql/src/pl_funcs.c
src/pl/plpgsql/src/plpgsql.h
src/pl/plpython/plpython.c
src/pl/tcl/pltcl.c
src/port/chklocale.c
src/port/dirmod.c
src/port/exec.c
src/port/open.c
src/port/path.c
src/port/strlcat.c
src/test/regress/pg_regress.c
src/test/regress/pg_regress.h
src/test/regress/pg_regress_main.c
src/timezone/localtime.c
src/timezone/pgtz.c
src/timezone/pgtz.h
src/tools/fsync/test_fsync.c

index ec8cb72e3b7d5cf27fb0e5db00caa64965d94296..c57b9919c48db35234a17ff7ec5b779ee519d764 100644 (file)
@@ -1,5 +1,5 @@
 /******************************************************************************
-  $PostgreSQL: pgsql/contrib/cube/cube.c,v 1.33 2007/06/05 21:31:03 tgl Exp $
+  $PostgreSQL: pgsql/contrib/cube/cube.c,v 1.34 2007/11/15 21:14:29 momjian Exp $
 
   This file contains routines that can be bound to a Postgres backend and
   called by the backend in the process of processing queries.  The calling
@@ -306,7 +306,7 @@ cube_subset(PG_FUNCTION_ARGS)
        result->x[i + dim] = c->x[dx[i] + c->dim - 1];
    }
 
-   PG_FREE_IF_COPY(c,0);
+   PG_FREE_IF_COPY(c, 0);
    PG_RETURN_NDBOX(result);
 }
 
@@ -360,7 +360,7 @@ cube_out(PG_FUNCTION_ARGS)
        appendStringInfoChar(&buf, ')');
    }
 
-   PG_FREE_IF_COPY(cube,0);
+   PG_FREE_IF_COPY(cube, 0);
    PG_RETURN_CSTRING(buf.data);
 }
 
@@ -381,20 +381,20 @@ g_cube_consistent(PG_FUNCTION_ARGS)
    GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
    NDBOX      *query = PG_GETARG_NDBOX(1);
    StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
-   bool        res;
+   bool        res;
 
    /*
     * if entry is not leaf, use g_cube_internal_consistent, else use
     * g_cube_leaf_consistent
     */
    if (GIST_LEAF(entry))
-       res = g_cube_leaf_consistent( DatumGetNDBOX(entry->key),
-                                     query, strategy);
+       res = g_cube_leaf_consistent(DatumGetNDBOX(entry->key),
+                                    query, strategy);
    else
-       res = g_cube_internal_consistent( DatumGetNDBOX(entry->key),
-                                         query, strategy);
+       res = g_cube_internal_consistent(DatumGetNDBOX(entry->key),
+                                        query, strategy);
 
-   PG_FREE_IF_COPY(query,1);
+   PG_FREE_IF_COPY(query, 1);
    PG_RETURN_BOOL(res);
 }
 
@@ -451,14 +451,15 @@ Datum
 g_cube_decompress(PG_FUNCTION_ARGS)
 {
    GISTENTRY  *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
-   NDBOX       *key = DatumGetNDBOX(PG_DETOAST_DATUM(entry->key));
+   NDBOX      *key = DatumGetNDBOX(PG_DETOAST_DATUM(entry->key));
 
    if (key != DatumGetNDBOX(entry->key))
    {
        GISTENTRY  *retval = (GISTENTRY *) palloc(sizeof(GISTENTRY));
+
        gistentryinit(*retval, PointerGetDatum(key),
-                       entry->rel, entry->page,
-                       entry->offset, FALSE);
+                     entry->rel, entry->page,
+                     entry->offset, FALSE);
        PG_RETURN_POINTER(retval);
    }
    PG_RETURN_POINTER(entry);
@@ -479,8 +480,8 @@ g_cube_penalty(PG_FUNCTION_ARGS)
    double      tmp1,
                tmp2;
 
-   ud = cube_union_v0( DatumGetNDBOX(origentry->key),
-                       DatumGetNDBOX(newentry->key));
+   ud = cube_union_v0(DatumGetNDBOX(origentry->key),
+                      DatumGetNDBOX(newentry->key));
    rt_cube_size(ud, &tmp1);
    rt_cube_size(DatumGetNDBOX(origentry->key), &tmp2);
    *result = (float) (tmp1 - tmp2);
@@ -812,12 +813,12 @@ cube_union(PG_FUNCTION_ARGS)
 {
    NDBOX      *a = PG_GETARG_NDBOX(0),
               *b = PG_GETARG_NDBOX(1);
-   NDBOX      *res; 
+   NDBOX      *res;
 
    res = cube_union_v0(a, b);
 
-   PG_FREE_IF_COPY(a,0);
-   PG_FREE_IF_COPY(b,1);
+   PG_FREE_IF_COPY(a, 0);
+   PG_FREE_IF_COPY(b, 1);
    PG_RETURN_NDBOX(res);
 }
 
@@ -876,8 +877,9 @@ cube_inter(PG_FUNCTION_ARGS)
                                   a->x[i + a->dim]), result->x[i + a->dim]);
    }
 
-   PG_FREE_IF_COPY(a,0);
-   PG_FREE_IF_COPY(b,1);
+   PG_FREE_IF_COPY(a, 0);
+   PG_FREE_IF_COPY(b, 1);
+
    /*
     * Is it OK to return a non-null intersection for non-overlapping boxes?
     */
@@ -899,7 +901,7 @@ cube_size(PG_FUNCTION_ARGS)
    for (i = 0, j = a->dim; i < a->dim; i++, j++)
        result = result * Abs((a->x[j] - a->x[i]));
 
-   PG_FREE_IF_COPY(a,0);
+   PG_FREE_IF_COPY(a, 0);
    PG_RETURN_FLOAT8(result);
 }
 
@@ -1011,8 +1013,8 @@ cube_cmp(PG_FUNCTION_ARGS)
 
    res = cube_cmp_v0(a, b);
 
-   PG_FREE_IF_COPY(a,0);
-   PG_FREE_IF_COPY(b,1);
+   PG_FREE_IF_COPY(a, 0);
+   PG_FREE_IF_COPY(b, 1);
    PG_RETURN_INT32(res);
 }
 
@@ -1026,8 +1028,8 @@ cube_eq(PG_FUNCTION_ARGS)
 
    res = cube_cmp_v0(a, b);
 
-   PG_FREE_IF_COPY(a,0);
-   PG_FREE_IF_COPY(b,1);
+   PG_FREE_IF_COPY(a, 0);
+   PG_FREE_IF_COPY(b, 1);
    PG_RETURN_BOOL(res == 0);
 }
 
@@ -1041,8 +1043,8 @@ cube_ne(PG_FUNCTION_ARGS)
 
    res = cube_cmp_v0(a, b);
 
-   PG_FREE_IF_COPY(a,0);
-   PG_FREE_IF_COPY(b,1);
+   PG_FREE_IF_COPY(a, 0);
+   PG_FREE_IF_COPY(b, 1);
    PG_RETURN_BOOL(res != 0);
 }
 
@@ -1056,8 +1058,8 @@ cube_lt(PG_FUNCTION_ARGS)
 
    res = cube_cmp_v0(a, b);
 
-   PG_FREE_IF_COPY(a,0);
-   PG_FREE_IF_COPY(b,1);
+   PG_FREE_IF_COPY(a, 0);
+   PG_FREE_IF_COPY(b, 1);
    PG_RETURN_BOOL(res < 0);
 }
 
@@ -1071,8 +1073,8 @@ cube_gt(PG_FUNCTION_ARGS)
 
    res = cube_cmp_v0(a, b);
 
-   PG_FREE_IF_COPY(a,0);
-   PG_FREE_IF_COPY(b,1);
+   PG_FREE_IF_COPY(a, 0);
+   PG_FREE_IF_COPY(b, 1);
    PG_RETURN_BOOL(res > 0);
 }
 
@@ -1086,8 +1088,8 @@ cube_le(PG_FUNCTION_ARGS)
 
    res = cube_cmp_v0(a, b);
 
-   PG_FREE_IF_COPY(a,0);
-   PG_FREE_IF_COPY(b,1);
+   PG_FREE_IF_COPY(a, 0);
+   PG_FREE_IF_COPY(b, 1);
    PG_RETURN_BOOL(res <= 0);
 }
 
@@ -1101,8 +1103,8 @@ cube_ge(PG_FUNCTION_ARGS)
 
    res = cube_cmp_v0(a, b);
 
-   PG_FREE_IF_COPY(a,0);
-   PG_FREE_IF_COPY(b,1);
+   PG_FREE_IF_COPY(a, 0);
+   PG_FREE_IF_COPY(b, 1);
    PG_RETURN_BOOL(res >= 0);
 }
 
@@ -1157,8 +1159,8 @@ cube_contains(PG_FUNCTION_ARGS)
 
    res = cube_contains_v0(a, b);
 
-   PG_FREE_IF_COPY(a,0);
-   PG_FREE_IF_COPY(b,1);
+   PG_FREE_IF_COPY(a, 0);
+   PG_FREE_IF_COPY(b, 1);
    PG_RETURN_BOOL(res);
 }
 
@@ -1173,8 +1175,8 @@ cube_contained(PG_FUNCTION_ARGS)
 
    res = cube_contains_v0(b, a);
 
-   PG_FREE_IF_COPY(a,0);
-   PG_FREE_IF_COPY(b,1);
+   PG_FREE_IF_COPY(a, 0);
+   PG_FREE_IF_COPY(b, 1);
    PG_RETURN_BOOL(res);
 }
 
@@ -1234,8 +1236,8 @@ cube_overlap(PG_FUNCTION_ARGS)
 
    res = cube_overlap_v0(a, b);
 
-   PG_FREE_IF_COPY(a,0);
-   PG_FREE_IF_COPY(b,1);
+   PG_FREE_IF_COPY(a, 0);
+   PG_FREE_IF_COPY(b, 1);
    PG_RETURN_BOOL(res);
 }
 
@@ -1281,8 +1283,8 @@ cube_distance(PG_FUNCTION_ARGS)
        distance += d * d;
    }
 
-   PG_FREE_IF_COPY(a,0);
-   PG_FREE_IF_COPY(b,1);
+   PG_FREE_IF_COPY(a, 0);
+   PG_FREE_IF_COPY(b, 1);
    PG_RETURN_FLOAT8(sqrt(distance));
 }
 
@@ -1317,7 +1319,7 @@ cube_is_point(PG_FUNCTION_ARGS)
            PG_RETURN_BOOL(FALSE);
    }
 
-   PG_FREE_IF_COPY(a,0);
+   PG_FREE_IF_COPY(a, 0);
    PG_RETURN_BOOL(TRUE);
 }
 
@@ -1331,7 +1333,7 @@ cube_dim(PG_FUNCTION_ARGS)
    c = PG_GETARG_NDBOX(0);
    dim = c->dim;
 
-   PG_FREE_IF_COPY(c,0);
+   PG_FREE_IF_COPY(c, 0);
    PG_RETURN_INT32(c->dim);
 }
 
@@ -1350,7 +1352,7 @@ cube_ll_coord(PG_FUNCTION_ARGS)
    if (c->dim >= n && n > 0)
        result = Min(c->x[n - 1], c->x[c->dim + n - 1]);
 
-   PG_FREE_IF_COPY(c,0);
+   PG_FREE_IF_COPY(c, 0);
    PG_RETURN_FLOAT8(result);
 }
 
@@ -1369,7 +1371,7 @@ cube_ur_coord(PG_FUNCTION_ARGS)
    if (c->dim >= n && n > 0)
        result = Max(c->x[n - 1], c->x[c->dim + n - 1]);
 
-   PG_FREE_IF_COPY(c,0);
+   PG_FREE_IF_COPY(c, 0);
    PG_RETURN_FLOAT8(result);
 }
 
@@ -1384,7 +1386,7 @@ cube_enlarge(PG_FUNCTION_ARGS)
                j,
                k;
    NDBOX      *a;
-   double      r;
+   double      r;
    int4        n;
 
    a = PG_GETARG_NDBOX(0);
@@ -1426,7 +1428,7 @@ cube_enlarge(PG_FUNCTION_ARGS)
        result->x[j] = r;
    }
 
-   PG_FREE_IF_COPY(a,0);
+   PG_FREE_IF_COPY(a, 0);
    PG_RETURN_NDBOX(result);
 }
 
@@ -1490,7 +1492,7 @@ cube_c_f8(PG_FUNCTION_ARGS)
    result->x[result->dim - 1] = x;
    result->x[2 * result->dim - 1] = x;
 
-   PG_FREE_IF_COPY(c,0);
+   PG_FREE_IF_COPY(c, 0);
    PG_RETURN_NDBOX(result);
 }
 
@@ -1521,6 +1523,6 @@ cube_c_f8_f8(PG_FUNCTION_ARGS)
    result->x[result->dim - 1] = x1;
    result->x[2 * result->dim - 1] = x2;
 
-   PG_FREE_IF_COPY(c,0);
+   PG_FREE_IF_COPY(c, 0);
    PG_RETURN_NDBOX(result);
 }
index 295a77977255369ecde26b4571fa760ce9f8fc9a..dd5cfc7f86d1f8a8955654a69578798286e16e29 100644 (file)
@@ -8,7 +8,7 @@
  * Darko Prenosil <Darko.Prenosil@finteh.hr>
  * Shridhar Daithankar <shridhar_daithankar@persistent.co.in>
  *
- * $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.65 2007/08/27 01:24:50 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/dblink/dblink.c,v 1.66 2007/11/15 21:14:29 momjian Exp $
  * Copyright (c) 2001-2007, PostgreSQL Global Development Group
  * ALL RIGHTS RESERVED;
  *
@@ -256,10 +256,10 @@ dblink_connect(PG_FUNCTION_ARGS)
                pfree(rconn);
 
            ereport(ERROR,
-                   (errcode(ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED),
-                    errmsg("password is required"),
-                    errdetail("Non-superuser cannot connect if the server does not request a password."),
-                    errhint("Target server's authentication method must be changed.")));
+                 (errcode(ERRCODE_S_R_E_PROHIBITED_SQL_STATEMENT_ATTEMPTED),
+                  errmsg("password is required"),
+                  errdetail("Non-superuser cannot connect if the server does not request a password."),
+                  errhint("Target server's authentication method must be changed.")));
        }
    }
 
index 85d45491ccbfe13c113291c8e3acac71c0a56064..5cc2111adcb8c69ecdc9bf8f32c27ca223cc41ef 100644 (file)
@@ -6,7 +6,7 @@
  * Copyright (c) 2007, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/contrib/dict_int/dict_int.c,v 1.1 2007/10/15 21:36:50 tgl Exp $
+ *   $PostgreSQL: pgsql/contrib/dict_int/dict_int.c,v 1.2 2007/11/15 21:14:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 PG_MODULE_MAGIC;
 
 
-typedef struct {
-   int     maxlen;
-   bool    rejectlong;
-} DictInt;
+typedef struct
+{
+   int         maxlen;
+   bool        rejectlong;
+}  DictInt;
 
 
 PG_FUNCTION_INFO_V1(dintdict_init);
-Datum dintdict_init(PG_FUNCTION_ARGS);
+Datum      dintdict_init(PG_FUNCTION_ARGS);
 
 PG_FUNCTION_INFO_V1(dintdict_lexize);
-Datum dintdict_lexize(PG_FUNCTION_ARGS);
+Datum      dintdict_lexize(PG_FUNCTION_ARGS);
 
 Datum
 dintdict_init(PG_FUNCTION_ARGS)
 {
-   List        *dictoptions = (List *) PG_GETARG_POINTER(0);
-   DictInt     *d;
-   ListCell    *l;
+   List       *dictoptions = (List *) PG_GETARG_POINTER(0);
+   DictInt    *d;
+   ListCell   *l;
 
    d = (DictInt *) palloc0(sizeof(DictInt));
    d->maxlen = 6;
@@ -44,7 +45,7 @@ dintdict_init(PG_FUNCTION_ARGS)
 
    foreach(l, dictoptions)
    {
-       DefElem *defel = (DefElem *) lfirst(l);
+       DefElem    *defel = (DefElem *) lfirst(l);
 
        if (pg_strcasecmp(defel->defname, "MAXLEN") == 0)
        {
@@ -62,22 +63,22 @@ dintdict_init(PG_FUNCTION_ARGS)
                            defel->defname)));
        }
    }
-   
+
    PG_RETURN_POINTER(d);
 }
 
 Datum
 dintdict_lexize(PG_FUNCTION_ARGS)
 {
-   DictInt *d = (DictInt*)PG_GETARG_POINTER(0);
-   char       *in = (char*)PG_GETARG_POINTER(1);
-   char *txt = pnstrdup(in, PG_GETARG_INT32(2));
-   TSLexeme *res=palloc(sizeof(TSLexeme)*2);
+   DictInt    *d = (DictInt *) PG_GETARG_POINTER(0);
+   char       *in = (char *) PG_GETARG_POINTER(1);
+   char       *txt = pnstrdup(in, PG_GETARG_INT32(2));
+   TSLexeme   *res = palloc(sizeof(TSLexeme) * 2);
 
    res[1].lexeme = NULL;
-   if  (PG_GETARG_INT32(2) > d->maxlen)
+   if (PG_GETARG_INT32(2) > d->maxlen)
    {
-       if ( d->rejectlong )
+       if (d->rejectlong)
        {
            /* reject by returning void array */
            pfree(txt);
index 1cd53a26bd1398cc58e02378dedf4d3a28e317fc..753886117dad6490fe45493a004a1066316bf2d0 100644 (file)
@@ -6,7 +6,7 @@
  * Copyright (c) 2007, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/contrib/dict_xsyn/dict_xsyn.c,v 1.1 2007/10/15 21:36:50 tgl Exp $
+ *   $PostgreSQL: pgsql/contrib/dict_xsyn/dict_xsyn.c,v 1.2 2007/11/15 21:14:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -24,29 +24,30 @@ PG_MODULE_MAGIC;
 
 typedef struct
 {
-   char *key; /* Word */
-   char *value; /* Unparsed list of synonyms, including the word itself */
+   char       *key;            /* Word */
+   char       *value;          /* Unparsed list of synonyms, including the
+                                * word itself */
 }  Syn;
 
 typedef struct
 {
-   int len;
-   Syn *syn;
+   int         len;
+   Syn        *syn;
 
-   bool keeporig;
+   bool        keeporig;
 }  DictSyn;
 
 
 PG_FUNCTION_INFO_V1(dxsyn_init);
-Datum dxsyn_init(PG_FUNCTION_ARGS);
+Datum      dxsyn_init(PG_FUNCTION_ARGS);
 
 PG_FUNCTION_INFO_V1(dxsyn_lexize);
-Datum dxsyn_lexize(PG_FUNCTION_ARGS);
+Datum      dxsyn_lexize(PG_FUNCTION_ARGS);
 
 static char *
 find_word(char *in, char **end)
 {
-   char *start;
+   char       *start;
 
    *end = NULL;
    while (*in && t_isspace(in))
@@ -71,12 +72,12 @@ compare_syn(const void *a, const void *b)
 }
 
 static void
-read_dictionary(DictSyn *d, char *filename)
+read_dictionary(DictSyn * d, char *filename)
 {
-   char *real_filename = get_tsearch_config_filename(filename, "rules");
-   FILE *fin;
-   char *line;
-   int cur = 0;
+   char       *real_filename = get_tsearch_config_filename(filename, "rules");
+   FILE       *fin;
+   char       *line;
+   int         cur = 0;
 
    if ((fin = AllocateFile(real_filename, "r")) == NULL)
        ereport(ERROR,
@@ -86,9 +87,9 @@ read_dictionary(DictSyn *d, char *filename)
 
    while ((line = t_readline(fin)) != NULL)
    {
-       char *value;
-       char *key;
-       char *end = NULL;
+       char       *value;
+       char       *key;
+       char       *end = NULL;
 
        if (*line == '\0')
            continue;
@@ -130,9 +131,9 @@ read_dictionary(DictSyn *d, char *filename)
 Datum
 dxsyn_init(PG_FUNCTION_ARGS)
 {
-   List *dictoptions = (List *) PG_GETARG_POINTER(0);
-   DictSyn *d;
-   ListCell *l;
+   List       *dictoptions = (List *) PG_GETARG_POINTER(0);
+   DictSyn    *d;
+   ListCell   *l;
 
    d = (DictSyn *) palloc0(sizeof(DictSyn));
    d->len = 0;
@@ -141,7 +142,7 @@ dxsyn_init(PG_FUNCTION_ARGS)
 
    foreach(l, dictoptions)
    {
-       DefElem *defel = (DefElem *) lfirst(l);
+       DefElem    *defel = (DefElem *) lfirst(l);
 
        if (pg_strcasecmp(defel->defname, "KEEPORIG") == 0)
        {
@@ -166,19 +167,19 @@ dxsyn_init(PG_FUNCTION_ARGS)
 Datum
 dxsyn_lexize(PG_FUNCTION_ARGS)
 {
-   DictSyn *d = (DictSyn *) PG_GETARG_POINTER(0);
-   char *in = (char *) PG_GETARG_POINTER(1);
-   int length = PG_GETARG_INT32(2);
-   Syn word;
-   Syn *found;
-   TSLexeme *res = NULL;
+   DictSyn    *d = (DictSyn *) PG_GETARG_POINTER(0);
+   char       *in = (char *) PG_GETARG_POINTER(1);
+   int         length = PG_GETARG_INT32(2);
+   Syn         word;
+   Syn        *found;
+   TSLexeme   *res = NULL;
 
    if (!length || d->len == 0)
        PG_RETURN_POINTER(NULL);
 
    /* Create search pattern */
    {
-       char *temp = pnstrdup(in, length);
+       char       *temp = pnstrdup(in, length);
 
        word.key = lowerstr(temp);
        pfree(temp);
@@ -186,7 +187,7 @@ dxsyn_lexize(PG_FUNCTION_ARGS)
    }
 
    /* Look for matching syn */
-   found = (Syn *)bsearch(&word, d->syn, d->len, sizeof(Syn), compare_syn);
+   found = (Syn *) bsearch(&word, d->syn, d->len, sizeof(Syn), compare_syn);
    pfree(word.key);
 
    if (!found)
@@ -194,28 +195,28 @@ dxsyn_lexize(PG_FUNCTION_ARGS)
 
    /* Parse string of synonyms and return array of words */
    {
-       char *value = pstrdup(found->value);
-       int value_length = strlen(value);
-       char *pos = value;
-       int nsyns = 0;
-       bool is_first = true;
+       char       *value = pstrdup(found->value);
+       int         value_length = strlen(value);
+       char       *pos = value;
+       int         nsyns = 0;
+       bool        is_first = true;
 
        res = palloc(0);
 
-       while(pos < value + value_length)
+       while (pos < value + value_length)
        {
-           char *end;
-           char *syn = find_word(pos, &end);
+           char       *end;
+           char       *syn = find_word(pos, &end);
 
            if (!syn)
                break;
            *end = '\0';
 
-           res = repalloc(res, sizeof(TSLexeme)*(nsyns + 2));
+           res = repalloc(res, sizeof(TSLexeme) * (nsyns + 2));
            res[nsyns].lexeme = NULL;
 
            /* first word is added to result only if KEEPORIG flag is set */
-           if(d->keeporig || !is_first)
+           if (d->keeporig || !is_first)
            {
                res[nsyns].lexeme = pstrdup(syn);
                res[nsyns + 1].lexeme = NULL;
index 5ef18abd8e8b5c95744b49184204fff2d22265d5..48ec6e064880bd3fd0a950782b05c181280a8059 100644 (file)
@@ -50,7 +50,7 @@ typedef struct
 int            comparePairs(const void *a, const void *b);
 int            uniquePairs(Pairs * a, int4 l, int4 *buflen);
 
-#define HStoreContainsStrategyNumber    7
-#define HStoreExistsStrategyNumber      9
+#define HStoreContainsStrategyNumber   7
+#define HStoreExistsStrategyNumber     9
 
 #endif
index f6fab2b89d6e4ff1ef76219d7493148759aeaa95..144758f3cd5e60863872baa910dfe38e674a08fe 100644 (file)
@@ -1,24 +1,24 @@
 #include "hstore.h"
 
-#include "access/gin.h"   
+#include "access/gin.h"
 
-#define    KEYFLAG     'K'
-#define    VALFLAG     'V'
-#define    NULLFLAG    'N'
+#define KEYFLAG        'K'
+#define VALFLAG        'V'
+#define NULLFLAG   'N'
 
 PG_FUNCTION_INFO_V1(gin_extract_hstore);
-Datum       gin_extract_hstore(PG_FUNCTION_ARGS);
+Datum      gin_extract_hstore(PG_FUNCTION_ARGS);
 
-static text*
-makeitem( char *str, int len )
+static text *
+makeitem(char *str, int len)
 {
-   text    *item;
+   text       *item;
 
-   item = (text*)palloc( VARHDRSZ + len + 1 );
+   item = (text *) palloc(VARHDRSZ + len + 1);
    SET_VARSIZE(item, VARHDRSZ + len + 1);
 
-   if ( str && len > 0 )
-       memcpy( VARDATA(item)+1, str, len );
+   if (str && len > 0)
+       memcpy(VARDATA(item) + 1, str, len);
 
    return item;
 }
@@ -26,37 +26,37 @@ makeitem( char *str, int len )
 Datum
 gin_extract_hstore(PG_FUNCTION_ARGS)
 {
-   HStore  *hs = PG_GETARG_HS(0);
-   int32   *nentries = (int32 *) PG_GETARG_POINTER(1);
-   Datum   *entries = NULL;
+   HStore     *hs = PG_GETARG_HS(0);
+   int32      *nentries = (int32 *) PG_GETARG_POINTER(1);
+   Datum      *entries = NULL;
 
-   *nentries = 2*hs->size;
+   *nentries = 2 * hs->size;
 
-   if ( hs->size > 0 )
+   if (hs->size > 0)
    {
-       HEntry  *ptr = ARRPTR(hs);
-       char    *words = STRPTR(hs);
-       int     i=0;
+       HEntry     *ptr = ARRPTR(hs);
+       char       *words = STRPTR(hs);
+       int         i = 0;
 
-       entries = (Datum*)palloc( sizeof(Datum) * 2 * hs->size );
+       entries = (Datum *) palloc(sizeof(Datum) * 2 * hs->size);
 
        while (ptr - ARRPTR(hs) < hs->size)
        {
-           text    *item;
+           text       *item;
 
-           item = makeitem( words + ptr->pos, ptr->keylen ); 
+           item = makeitem(words + ptr->pos, ptr->keylen);
            *VARDATA(item) = KEYFLAG;
            entries[i++] = PointerGetDatum(item);
 
-           if ( ptr->valisnull )
+           if (ptr->valisnull)
            {
-               item = makeitem( NULL, 0 ); 
+               item = makeitem(NULL, 0);
                *VARDATA(item) = NULLFLAG;
 
            }
            else
            {
-               item = makeitem( words + ptr->pos + ptr->keylen, ptr->vallen ); 
+               item = makeitem(words + ptr->pos + ptr->keylen, ptr->vallen);
                *VARDATA(item) = VALFLAG;
            }
            entries[i++] = PointerGetDatum(item);
@@ -65,36 +65,37 @@ gin_extract_hstore(PG_FUNCTION_ARGS)
        }
    }
 
-   PG_FREE_IF_COPY(hs,0);
+   PG_FREE_IF_COPY(hs, 0);
    PG_RETURN_POINTER(entries);
 }
 
 PG_FUNCTION_INFO_V1(gin_extract_hstore_query);
-Datum       gin_extract_hstore_query(PG_FUNCTION_ARGS);
+Datum      gin_extract_hstore_query(PG_FUNCTION_ARGS);
 
 Datum
 gin_extract_hstore_query(PG_FUNCTION_ARGS)
 {
    StrategyNumber strategy = PG_GETARG_UINT16(2);
 
-   if ( strategy == HStoreContainsStrategyNumber )
+   if (strategy == HStoreContainsStrategyNumber)
    {
-       PG_RETURN_DATUM( DirectFunctionCall2(
-               gin_extract_hstore,
-               PG_GETARG_DATUM(0),
-               PG_GETARG_DATUM(1)
-       ));
+       PG_RETURN_DATUM(DirectFunctionCall2(
+                                           gin_extract_hstore,
+                                           PG_GETARG_DATUM(0),
+                                           PG_GETARG_DATUM(1)
+                                           ));
    }
-   else if ( strategy == HStoreExistsStrategyNumber )
+   else if (strategy == HStoreExistsStrategyNumber)
    {
-       text *item, *q = PG_GETARG_TEXT_P(0);
-       int32   *nentries = (int32 *) PG_GETARG_POINTER(1);
-       Datum   *entries = NULL;
+       text       *item,
+                  *q = PG_GETARG_TEXT_P(0);
+       int32      *nentries = (int32 *) PG_GETARG_POINTER(1);
+       Datum      *entries = NULL;
 
        *nentries = 1;
-       entries = (Datum*)palloc( sizeof(Datum) );
+       entries = (Datum *) palloc(sizeof(Datum));
 
-       item = makeitem( VARDATA(q), VARSIZE(q)-VARHDRSZ );
+       item = makeitem(VARDATA(q), VARSIZE(q) - VARHDRSZ);
        *VARDATA(item) = KEYFLAG;
        entries[0] = PointerGetDatum(item);
 
@@ -107,29 +108,28 @@ gin_extract_hstore_query(PG_FUNCTION_ARGS)
 }
 
 PG_FUNCTION_INFO_V1(gin_consistent_hstore);
-Datum       gin_consistent_hstore(PG_FUNCTION_ARGS);
+Datum      gin_consistent_hstore(PG_FUNCTION_ARGS);
 
 Datum
 gin_consistent_hstore(PG_FUNCTION_ARGS)
 {
    StrategyNumber strategy = PG_GETARG_UINT16(1);
-   bool    res = true;
+   bool        res = true;
 
-   if ( strategy == HStoreContainsStrategyNumber )
+   if (strategy == HStoreContainsStrategyNumber)
    {
-       bool    *check = (bool *) PG_GETARG_POINTER(0);
-       HStore  *query = PG_GETARG_HS(2);
-       int     i;
+       bool       *check = (bool *) PG_GETARG_POINTER(0);
+       HStore     *query = PG_GETARG_HS(2);
+       int         i;
 
-       for(i=0;res && i<2*query->size;i++)
-           if ( check[i] == false )
+       for (i = 0; res && i < 2 * query->size; i++)
+           if (check[i] == false)
                res = false;
    }
-   else if ( strategy == HStoreExistsStrategyNumber )
+   else if (strategy == HStoreExistsStrategyNumber)
        res = true;
    else
        elog(ERROR, "Unsupported strategy number: %d", strategy);
 
    PG_RETURN_BOOL(res);
 }
-
index 74597c3490009eae734a49b1b108c857b353dd04..bcac30ee6fdd3c4720c862eaf5ac9dade3619e2e 100644 (file)
@@ -275,13 +275,13 @@ tconvert(PG_FUNCTION_ARGS)
    int         len;
    HStore     *out;
 
-   if ( PG_ARGISNULL(0) )
+   if (PG_ARGISNULL(0))
        PG_RETURN_NULL();
 
    key = PG_GETARG_TEXT_P(0);
 
-   if ( PG_ARGISNULL(1) )
-       len = CALCDATASIZE(1, VARSIZE(key) );
+   if (PG_ARGISNULL(1))
+       len = CALCDATASIZE(1, VARSIZE(key));
    else
    {
        val = PG_GETARG_TEXT_P(1);
@@ -292,7 +292,7 @@ tconvert(PG_FUNCTION_ARGS)
    out->size = 1;
 
    ARRPTR(out)->keylen = VARSIZE(key) - VARHDRSZ;
-   if ( PG_ARGISNULL(1) )
+   if (PG_ARGISNULL(1))
    {
        ARRPTR(out)->vallen = 0;
        ARRPTR(out)->valisnull = true;
@@ -537,18 +537,18 @@ hs_contains(PG_FUNCTION_ARGS)
 
        if (entry)
        {
-           if ( te->valisnull || entry->valisnull )
+           if (te->valisnull || entry->valisnull)
            {
-               if ( !(te->valisnull && entry->valisnull) )
+               if (!(te->valisnull && entry->valisnull))
                    res = false;
            }
-           else if ( te->vallen != entry->vallen ||  
-                                         strncmp(
-                                            vv + entry->pos + entry->keylen,
-                                                 tv + te->pos + te->keylen,
-                                                 te->vallen) 
-                                         )
-                   res = false;
+           else if (te->vallen != entry->vallen ||
+                    strncmp(
+                            vv + entry->pos + entry->keylen,
+                            tv + te->pos + te->keylen,
+                            te->vallen)
+               )
+               res = false;
        }
        else
            res = false;
index 22484287862d26619d75c1aa3668d8cd98fc6351..6856a68e03835ba7af33be65f4069f3391210e09 100644 (file)
@@ -57,16 +57,17 @@ ginint4_queryextract(PG_FUNCTION_ARGS)
        }
    }
 
-   if ( nentries == 0 )
+   if (nentries == 0)
    {
-       switch( strategy )
+       switch (strategy)
        {
            case BooleanSearchStrategy:
            case RTOverlapStrategyNumber:
-                   *nentries = -1; /* nobody can be found */
-                   break;
-           default:   /* require fullscan: GIN can't find void arrays */
-           break;
+               *nentries = -1; /* nobody can be found */
+               break;
+           default:            /* require fullscan: GIN can't find void
+                                * arrays */
+               break;
        }
    }
 
index 3c34cb67a7aa7a6cef4c7a9ec9d9240ea39272d3..51cc77b863db996780ad708c37e4fee8e7eb381e 100644 (file)
@@ -233,10 +233,11 @@ g_int_decompress(PG_FUNCTION_ARGS)
    CHECKARRVALID(in);
    if (ARRISVOID(in))
    {
-       if (in != (ArrayType *) DatumGetPointer(entry->key)) {
+       if (in != (ArrayType *) DatumGetPointer(entry->key))
+       {
            retval = palloc(sizeof(GISTENTRY));
            gistentryinit(*retval, PointerGetDatum(in),
-               entry->rel, entry->page, entry->offset, FALSE);
+                         entry->rel, entry->page, entry->offset, FALSE);
            PG_RETURN_POINTER(retval);
        }
 
index 1dfb940e92982d119a680ea72d558b691119dda0..9134fc06d82f40895b29695b6347e916eeacc6f3 100644 (file)
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/contrib/isn/isn.c,v 1.6 2007/06/05 21:31:03 tgl Exp $
+ *   $PostgreSQL: pgsql/contrib/isn/isn.c,v 1.7 2007/11/15 21:14:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -506,7 +506,7 @@ ean2UPC(char *isn)
  * Returns the ean13 value of the string.
  */
 static
-ean13
+           ean13
 str2ean(const char *num)
 {
    ean13       ean = 0;        /* current ean */
index 6251fd5b5f918149036f6e8ab05b6c52771e8520..ce8b97e46baadd6888c975ba8808fa99e98dfd48 100644 (file)
@@ -302,9 +302,9 @@ bt_page_items(PG_FUNCTION_ARGS)
        buffer = ReadBuffer(rel, blkno);
 
        /*
-        * We copy the page into local storage to avoid holding pin on
-        * the buffer longer than we must, and possibly failing to
-        * release it at all if the calling query doesn't fetch all rows.
+        * We copy the page into local storage to avoid holding pin on the
+        * buffer longer than we must, and possibly failing to release it at
+        * all if the calling query doesn't fetch all rows.
         */
        mctx = MemoryContextSwitchTo(fctx->multi_call_memory_ctx);
 
index 931c1a5036594fc3a6108d6311a26d590faa5e48..31b5b2e642e2239e54a667e7cc7af25375ce3f6a 100644 (file)
@@ -8,17 +8,17 @@
  * information as possible, even if it's nonsense. That's because if a
  * page is corrupt, we don't know why and how exactly it is corrupt, so we
  * let the user to judge it.
- * 
+ *
  * These functions are restricted to superusers for the fear of introducing
- * security holes if the input checking isn't as water-tight as it should. 
- * You'd need to be superuser to obtain a raw page image anyway, so 
+ * security holes if the input checking isn't as water-tight as it should.
+ * You'd need to be superuser to obtain a raw page image anyway, so
  * there's hardly any use case for using these without superuser-rights
  * anyway.
  *
  * Copyright (c) 2007, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/contrib/pageinspect/heapfuncs.c,v 1.2 2007/09/12 22:10:25 tgl Exp $
+ *   $PostgreSQL: pgsql/contrib/pageinspect/heapfuncs.c,v 1.3 2007/11/15 21:14:30 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include "utils/builtins.h"
 #include "miscadmin.h"
 
-Datum heap_page_items(PG_FUNCTION_ARGS);
+Datum      heap_page_items(PG_FUNCTION_ARGS);
 
 #define GET_TEXT(str_) \
-        DirectFunctionCall1(textin, CStringGetDatum(str_))
+       DirectFunctionCall1(textin, CStringGetDatum(str_))
 
 /*
  * bits_to_text
@@ -48,12 +48,12 @@ Datum heap_page_items(PG_FUNCTION_ARGS);
 static char *
 bits_to_text(bits8 *bits, int len)
 {
-   int i;
-   char *str;
+   int         i;
+   char       *str;
 
    str = palloc(len + 1);
-   
-   for(i = 0; i < len; i++)
+
+   for (i = 0; i < len; i++)
        str[i] = (bits[(i / 8)] & (1 << (i % 8))) ? '1' : '0';
 
    str[i] = '\0';
@@ -74,15 +74,15 @@ typedef struct heap_page_items_state
    TupleDesc   tupd;
    Page        page;
    uint16      offset;
-} heap_page_items_state;
+}  heap_page_items_state;
 
 Datum
 heap_page_items(PG_FUNCTION_ARGS)
 {
-   bytea  *raw_page = PG_GETARG_BYTEA_P(0);
+   bytea      *raw_page = PG_GETARG_BYTEA_P(0);
    heap_page_items_state *inter_call_data = NULL;
    FuncCallContext *fctx;
-   int     raw_page_size;
+   int         raw_page_size;
 
    if (!superuser())
        ereport(ERROR,
@@ -96,10 +96,10 @@ heap_page_items(PG_FUNCTION_ARGS)
        TupleDesc   tupdesc;
        MemoryContext mctx;
 
-       if(raw_page_size < SizeOfPageHeaderData)
-           ereport(ERROR, 
+       if (raw_page_size < SizeOfPageHeaderData)
+           ereport(ERROR,
                    (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                    errmsg("input page too small (%d bytes)", raw_page_size)));
+                 errmsg("input page too small (%d bytes)", raw_page_size)));
 
        fctx = SRF_FIRSTCALL_INIT();
        mctx = MemoryContextSwitchTo(fctx->multi_call_memory_ctx);
@@ -132,42 +132,42 @@ heap_page_items(PG_FUNCTION_ARGS)
        ItemId      id;
        Datum       values[13];
        bool        nulls[13];
-       uint16      lp_offset;
+       uint16      lp_offset;
        uint16      lp_flags;
        uint16      lp_len;
 
        memset(nulls, 0, sizeof(nulls));
 
        /* Extract information from the line pointer */
-       
+
        id = PageGetItemId(page, inter_call_data->offset);
 
-       lp_offset   = ItemIdGetOffset(id);
-       lp_flags    = ItemIdGetFlags(id);
-       lp_len      = ItemIdGetLength(id);
+       lp_offset = ItemIdGetOffset(id);
+       lp_flags = ItemIdGetFlags(id);
+       lp_len = ItemIdGetLength(id);
 
        values[0] = UInt16GetDatum(inter_call_data->offset);
        values[1] = UInt16GetDatum(lp_offset);
        values[2] = UInt16GetDatum(lp_flags);
        values[3] = UInt16GetDatum(lp_len);
 
-       /* We do just enough validity checking to make sure we don't 
-        * reference data outside the page passed to us. The page
-        * could be corrupt in many other ways, but at least we won't 
-        * crash.
+       /*
+        * We do just enough validity checking to make sure we don't reference
+        * data outside the page passed to us. The page could be corrupt in
+        * many other ways, but at least we won't crash.
         */
        if (ItemIdHasStorage(id) &&
            lp_len >= sizeof(HeapTupleHeader) &&
            lp_offset == MAXALIGN(lp_offset) &&
            lp_offset + lp_len <= raw_page_size)
        {
-           HeapTupleHeader tuphdr;
-           int             bits_len;
+           HeapTupleHeader tuphdr;
+           int         bits_len;
 
            /* Extract information from the tuple header */
 
            tuphdr = (HeapTupleHeader) PageGetItem(page, id);
-       
+
            values[4] = UInt32GetDatum(HeapTupleHeaderGetXmin(tuphdr));
            values[5] = UInt32GetDatum(HeapTupleHeaderGetXmax(tuphdr));
            values[6] = UInt32GetDatum(HeapTupleHeaderGetRawCommandId(tuphdr)); /* shared with xvac */
@@ -176,22 +176,23 @@ heap_page_items(PG_FUNCTION_ARGS)
            values[9] = UInt16GetDatum(tuphdr->t_infomask);
            values[10] = UInt8GetDatum(tuphdr->t_hoff);
 
-           /* We already checked that the item as is completely within
-            * the raw page passed to us, with the length given in the line
+           /*
+            * We already checked that the item as is completely within the
+            * raw page passed to us, with the length given in the line
             * pointer.. Let's check that t_hoff doesn't point over lp_len,
             * before using it to access t_bits and oid.
             */
-           if (tuphdr->t_hoff >= sizeof(HeapTupleHeader) && 
+           if (tuphdr->t_hoff >= sizeof(HeapTupleHeader) &&
                tuphdr->t_hoff <= lp_len)
            {
                if (tuphdr->t_infomask & HEAP_HASNULL)
                {
-                   bits_len = tuphdr->t_hoff - 
-                       (((char *)tuphdr->t_bits) - ((char *)tuphdr));
+                   bits_len = tuphdr->t_hoff -
+                       (((char *) tuphdr->t_bits) -((char *) tuphdr));
 
                    values[11] = GET_TEXT(
-                       bits_to_text(tuphdr->t_bits, bits_len * 8));
-               } 
+                                bits_to_text(tuphdr->t_bits, bits_len * 8));
+               }
                else
                    nulls[11] = true;
 
@@ -208,17 +209,19 @@ heap_page_items(PG_FUNCTION_ARGS)
        }
        else
        {
-           /* The line pointer is not used, or it's invalid. Set the rest of
-            * the fields to NULL */
-           int i;
+           /*
+            * The line pointer is not used, or it's invalid. Set the rest of
+            * the fields to NULL
+            */
+           int         i;
 
-           for(i = 4; i <= 12; i++)
+           for (i = 4; i <= 12; i++)
                nulls[i] = true;
        }
 
-        /* Build and return the result tuple. */
-        resultTuple = heap_form_tuple(inter_call_data->tupd, values, nulls);
-        result = HeapTupleGetDatum(resultTuple);
+       /* Build and return the result tuple. */
+       resultTuple = heap_form_tuple(inter_call_data->tupd, values, nulls);
+       result = HeapTupleGetDatum(resultTuple);
 
        inter_call_data->offset++;
 
index 80632be9fb55b9b61a1d65e369fdbef0b14ae458..7d69fd5e22ea3d7110efd4f92589829311150830 100644 (file)
@@ -8,7 +8,7 @@
  * Copyright (c) 2007, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/contrib/pageinspect/rawpage.c,v 1.2 2007/09/21 21:25:42 tgl Exp $
+ *   $PostgreSQL: pgsql/contrib/pageinspect/rawpage.c,v 1.3 2007/11/15 21:14:30 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -26,8 +26,8 @@
 
 PG_MODULE_MAGIC;
 
-Datum get_raw_page(PG_FUNCTION_ARGS);
-Datum page_header(PG_FUNCTION_ARGS);
+Datum      get_raw_page(PG_FUNCTION_ARGS);
+Datum      page_header(PG_FUNCTION_ARGS);
 
 /*
  * get_raw_page
@@ -43,9 +43,9 @@ get_raw_page(PG_FUNCTION_ARGS)
    uint32      blkno = PG_GETARG_UINT32(1);
 
    Relation    rel;
-   RangeVar    *relrv;
-   bytea       *raw_page;
-   char        *raw_page_data;
+   RangeVar   *relrv;
+   bytea      *raw_page;
+   char       *raw_page_data;
    Buffer      buf;
 
    if (!superuser())
@@ -61,12 +61,12 @@ get_raw_page(PG_FUNCTION_ARGS)
        ereport(ERROR,
                (errcode(ERRCODE_WRONG_OBJECT_TYPE),
                 errmsg("cannot get raw page from view \"%s\"",
-                           RelationGetRelationName(rel))));
+                       RelationGetRelationName(rel))));
    if (rel->rd_rel->relkind == RELKIND_COMPOSITE_TYPE)
        ereport(ERROR,
                (errcode(ERRCODE_WRONG_OBJECT_TYPE),
                 errmsg("cannot get raw page from composite type \"%s\"",
-                           RelationGetRelationName(rel))));
+                       RelationGetRelationName(rel))));
 
    if (blkno >= RelationGetNumberOfBlocks(rel))
        elog(ERROR, "block number %u is out of range for relation \"%s\"",
@@ -125,13 +125,13 @@ page_header(PG_FUNCTION_ARGS)
    raw_page_size = VARSIZE(raw_page) - VARHDRSZ;
 
    /*
-    * Check that enough data was supplied, so that we don't try to access 
-    * fields outside the supplied buffer. 
+    * Check that enough data was supplied, so that we don't try to access
+    * fields outside the supplied buffer.
     */
-   if(raw_page_size < sizeof(PageHeaderData))
-       ereport(ERROR, 
-            (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-             errmsg("input page too small (%d bytes)", raw_page_size)));
+   if (raw_page_size < sizeof(PageHeaderData))
+       ereport(ERROR,
+               (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+                errmsg("input page too small (%d bytes)", raw_page_size)));
 
    page = (PageHeader) VARDATA(raw_page);
 
@@ -154,12 +154,12 @@ page_header(PG_FUNCTION_ARGS)
    values[7] = UInt16GetDatum(PageGetPageLayoutVersion(page));
    values[8] = TransactionIdGetDatum(page->pd_prune_xid);
 
-    /* Build and return the tuple. */
+   /* Build and return the tuple. */
 
    memset(nulls, 0, sizeof(nulls));
 
-    tuple = heap_form_tuple(tupdesc, values, nulls);
-    result = HeapTupleGetDatum(tuple);
+   tuple = heap_form_tuple(tupdesc, values, nulls);
+   result = HeapTupleGetDatum(tuple);
 
    PG_RETURN_DATUM(result);
 }
index e7c5b06a563bfcc62ae236203dfab2a0133abb0e..21ac8da1764ad56f8585cd329c2aa3fc28b45597 100644 (file)
@@ -3,7 +3,7 @@
  * pg_buffercache_pages.c
  *   display some contents of the buffer cache
  *
- *   $PostgreSQL: pgsql/contrib/pg_buffercache/pg_buffercache_pages.c,v 1.13 2007/07/16 21:20:36 tgl Exp $
+ *   $PostgreSQL: pgsql/contrib/pg_buffercache/pg_buffercache_pages.c,v 1.14 2007/11/15 21:14:30 momjian Exp $
  *-------------------------------------------------------------------------
  */
 #include "postgres.h"
@@ -149,9 +149,9 @@ pg_buffercache_pages(PG_FUNCTION_ARGS)
        /*
         * And release locks.  We do this in reverse order for two reasons:
         * (1) Anyone else who needs more than one of the locks will be trying
-        * to lock them in increasing order; we don't want to release the other
-        * process until it can get all the locks it needs.
-        * (2) This avoids O(N^2) behavior inside LWLockRelease.
+        * to lock them in increasing order; we don't want to release the
+        * other process until it can get all the locks it needs. (2) This
+        * avoids O(N^2) behavior inside LWLockRelease.
         */
        for (i = NUM_BUFFER_PARTITIONS; --i >= 0;)
            LWLockRelease(FirstBufMappingLock + i);
index 35c90fde48472968aa8dcb41972fdd1835810969..41b3500dd11e8eb4fbf130800e595c2ef6f68fc1 100644 (file)
@@ -1,12 +1,12 @@
 /*
  * pg_standby.c
- * 
+ *
  * Production-ready example of how to create a Warm Standby
- * database server using continuous archiving as a 
+ * database server using continuous archiving as a
  * replication mechanism
  *
  * We separate the parameters for archive and nextWALfile
- * so that we can check the archive exists, even if the 
+ * so that we can check the archive exists, even if the
  * WAL file doesn't (yet).
  *
  * This program will be executed once in full for each file
@@ -14,9 +14,9 @@
  *
  * It is designed to cater to a variety of needs, as well
  * providing a customizable section.
- * 
- * Original author:        Simon Riggs  simon@2ndquadrant.com
- * Current maintainer:     Simon Riggs
+ *
+ * Original author:        Simon Riggs  simon@2ndquadrant.com
+ * Current maintainer: Simon Riggs
  */
 #include "postgres_fe.h"
 
@@ -26,7 +26,7 @@
 #include <signal.h>
 
 #ifdef WIN32
-int getopt(int argc, char * const argv[], const char *optstring);
+int            getopt(int argc, char *const argv[], const char *optstring);
 #else
 #include <sys/time.h>
 #include <unistd.h>
@@ -34,42 +34,44 @@ int getopt(int argc, char * const argv[], const char *optstring);
 #ifdef HAVE_GETOPT_H
 #include <getopt.h>
 #endif
-
 #endif   /* ! WIN32 */
 
 extern char *optarg;
 extern int optind;
 
 /* Options and defaults */
-int sleeptime = 5;             /* amount of time to sleep between file checks */
-int waittime = -1;             /* how long we have been waiting, -1 no wait yet */
-int maxwaittime = 0;           /* how long are we prepared to wait for? */
-int keepfiles = 0;             /* number of WAL files to keep, 0 keep all */
-int maxretries = 3;                /* number of retries on restore command */
-bool debug = false;                /* are we debugging? */
-bool triggered = false;            /* have we been triggered? */
-bool need_cleanup = false;     /* do we need to remove files from archive? */
+int            sleeptime = 5;      /* amount of time to sleep between file checks */
+int            waittime = -1;      /* how long we have been waiting, -1 no wait
+                                * yet */
+int            maxwaittime = 0;    /* how long are we prepared to wait for? */
+int            keepfiles = 0;      /* number of WAL files to keep, 0 keep all */
+int            maxretries = 3;     /* number of retries on restore command */
+bool       debug = false;      /* are we debugging? */
+bool       triggered = false;  /* have we been triggered? */
+bool       need_cleanup = false;       /* do we need to remove files from
+                                        * archive? */
 
 static volatile sig_atomic_t signaled = false;
 
-char *archiveLocation;       /* where to find the archive? */
-char *triggerPath;           /* where to find the trigger file? */
-char *xlogFilePath;              /* where we are going to restore to */
-char *nextWALFileName;       /* the file we need to get from archive */
-char *restartWALFileName;    /* the file from which we can restart restore */
-char *priorWALFileName;          /* the file we need to get from archive */
-char WALFilePath[MAXPGPATH];/* the file path including archive */
-char restoreCommand[MAXPGPATH]; /* run this to restore */
-char exclusiveCleanupFileName[MAXPGPATH];        /* the file we need to get from archive */
+char      *archiveLocation;    /* where to find the archive? */
+char      *triggerPath;        /* where to find the trigger file? */
+char      *xlogFilePath;       /* where we are going to restore to */
+char      *nextWALFileName;    /* the file we need to get from archive */
+char      *restartWALFileName; /* the file from which we can restart restore */
+char      *priorWALFileName;   /* the file we need to get from archive */
+char       WALFilePath[MAXPGPATH];     /* the file path including archive */
+char       restoreCommand[MAXPGPATH];  /* run this to restore */
+char       exclusiveCleanupFileName[MAXPGPATH];        /* the file we need to
+                                                        * get from archive */
 
 #define RESTORE_COMMAND_COPY 0
 #define RESTORE_COMMAND_LINK 1
-int restoreCommandType;         
+int            restoreCommandType;
 
 #define XLOG_DATA           0
 #define XLOG_HISTORY        1
 #define XLOG_BACKUP_LABEL   2
-int nextWALFileType;
+int            nextWALFileType;
 
 #define SET_RESTORE_COMMAND(cmd, arg1, arg2) \
    snprintf(restoreCommand, MAXPGPATH, cmd " \"%s\" \"%s\"", arg1, arg2)
@@ -86,21 +88,21 @@ struct stat stat_buf;
  * accessible directory. If you want to make other assumptions,
  * such as using a vendor-specific archive and access API, these
  * routines are the ones you'll need to change. You're
- *  enouraged to submit any changes to pgsql-patches@postgresql.org
- *     or personally to the current maintainer. Those changes may be 
+ * enouraged to submit any changes to pgsql-patches@postgresql.org
+ * or personally to the current maintainer. Those changes may be
  * folded in to later versions of this program.
  */
 
-#define XLOG_DATA_FNAME_LEN    24
+#define XLOG_DATA_FNAME_LEN        24
 /* Reworked from access/xlog_internal.h */
 #define XLogFileName(fname, tli, log, seg) \
    snprintf(fname, XLOG_DATA_FNAME_LEN + 1, "%08X%08X%08X", tli, log, seg)
 
 /*
- *  Initialize allows customized commands into the warm standby program.
+ * Initialize allows customized commands into the warm standby program.
  *
- *  As an example, and probably the common case, we use either
- *  cp/ln commands on *nix, or copy/move command on Windows.
+ * As an example, and probably the common case, we use either
+ * cp/ln commands on *nix, or copy/move command on Windows.
  *
  */
 static void
@@ -111,79 +113,79 @@ CustomizableInitialize(void)
    switch (restoreCommandType)
    {
        case RESTORE_COMMAND_LINK:
-           SET_RESTORE_COMMAND("mklink",WALFilePath, xlogFilePath);
+           SET_RESTORE_COMMAND("mklink", WALFilePath, xlogFilePath);
        case RESTORE_COMMAND_COPY:
        default:
-           SET_RESTORE_COMMAND("copy",WALFilePath, xlogFilePath);
+           SET_RESTORE_COMMAND("copy", WALFilePath, xlogFilePath);
            break;
-    }   
+   }
 #else
    snprintf(WALFilePath, MAXPGPATH, "%s/%s", archiveLocation, nextWALFileName);
    switch (restoreCommandType)
    {
        case RESTORE_COMMAND_LINK:
 #if HAVE_WORKING_LINK
-           SET_RESTORE_COMMAND("ln -s -f",WALFilePath, xlogFilePath);
+           SET_RESTORE_COMMAND("ln -s -f", WALFilePath, xlogFilePath);
            break;
 #endif
        case RESTORE_COMMAND_COPY:
        default:
-           SET_RESTORE_COMMAND("cp",WALFilePath, xlogFilePath);
+           SET_RESTORE_COMMAND("cp", WALFilePath, xlogFilePath);
            break;
-    }   
+   }
 #endif
 
    /*
-    * This code assumes that archiveLocation is a directory
-    * You may wish to add code to check for tape libraries, etc..
-    * So, since it is a directory, we use stat to test if its accessible
+    * This code assumes that archiveLocation is a directory You may wish to
+    * add code to check for tape libraries, etc.. So, since it is a
+    * directory, we use stat to test if its accessible
     */
    if (stat(archiveLocation, &stat_buf) != 0)
    {
-       fprintf(stderr, "pg_standby: archiveLocation \"%s\" does not exist\n", archiveLocation);
+       fprintf(stderr, "pg_standby: archiveLocation \"%s\" does not exist\n", archiveLocation);
        fflush(stderr);
-       exit(2);            
+       exit(2);
    }
 }
 
 /*
  * CustomizableNextWALFileReady()
- * 
+ *
  *   Is the requested file ready yet?
  */
-static bool 
+static bool
 CustomizableNextWALFileReady()
 {
    if (stat(WALFilePath, &stat_buf) == 0)
    {
        /*
-        * If its a backup file, return immediately
-        * If its a regular file return only if its the right size already
+        * If its a backup file, return immediately If its a regular file
+        * return only if its the right size already
         */
        if (strlen(nextWALFileName) > 24 &&
            strspn(nextWALFileName, "0123456789ABCDEF") == 24 &&
-           strcmp(nextWALFileName + strlen(nextWALFileName) - strlen(".backup"),
-                  ".backup") == 0)
+       strcmp(nextWALFileName + strlen(nextWALFileName) - strlen(".backup"),
+              ".backup") == 0)
        {
            nextWALFileType = XLOG_BACKUP_LABEL;
-               return true;
+           return true;
        }
-       else
-           if (stat_buf.st_size == XLOG_SEG_SIZE)
-           {
+       else if (stat_buf.st_size == XLOG_SEG_SIZE)
+       {
 #ifdef WIN32
-               /*
-                * Windows reports that the file has the right number of bytes
-                * even though the file is still being copied and cannot be
-                * opened by pg_standby yet. So we wait for sleeptime secs
-                * before attempting to restore. If that is not enough, we
-                * will rely on the retry/holdoff mechanism.
-                */
-               pg_usleep(sleeptime * 1000000L);
+
+           /*
+            * Windows reports that the file has the right number of bytes
+            * even though the file is still being copied and cannot be opened
+            * by pg_standby yet. So we wait for sleeptime secs before
+            * attempting to restore. If that is not enough, we will rely on
+            * the retry/holdoff mechanism.
+            */
+           pg_usleep(sleeptime * 1000000L);
 #endif
-               nextWALFileType = XLOG_DATA;
-               return true;
-           }
+           nextWALFileType = XLOG_DATA;
+           return true;
+       }
 
        /*
         * If still too small, wait until it is the correct size
@@ -192,10 +194,10 @@ CustomizableNextWALFileReady()
        {
            if (debug)
            {
-               fprintf(stderr, "file size greater than expected\n");
+               fprintf(stderr, "file size greater than expected\n");
                fflush(stderr);
            }
-           exit(3); 
+           exit(3);
        }
    }
 
@@ -212,35 +214,36 @@ CustomizableCleanupPriorWALFiles(void)
     */
    if (nextWALFileType == XLOG_DATA)
    {
-       int             rc;
-       DIR             *xldir;
-       struct dirent   *xlde;
+       int         rc;
+       DIR        *xldir;
+       struct dirent *xlde;
 
        /*
-        * Assume its OK to keep failing. The failure situation may change over
-        * time, so we'd rather keep going on the main processing than fail
-        * because we couldnt clean up yet.
+        * Assume its OK to keep failing. The failure situation may change
+        * over time, so we'd rather keep going on the main processing than
+        * fail because we couldnt clean up yet.
         */
        if ((xldir = opendir(archiveLocation)) != NULL)
        {
            while ((xlde = readdir(xldir)) != NULL)
            {
                /*
-                * We ignore the timeline part of the XLOG segment identifiers in
-                * deciding whether a segment is still needed.  This ensures that we
-                * won't prematurely remove a segment from a parent timeline. We could
-                * probably be a little more proactive about removing segments of
-                * non-parent timelines, but that would be a whole lot more
-                * complicated.
+                * We ignore the timeline part of the XLOG segment identifiers
+                * in deciding whether a segment is still needed.  This
+                * ensures that we won't prematurely remove a segment from a
+                * parent timeline. We could probably be a little more
+                * proactive about removing segments of non-parent timelines,
+                * but that would be a whole lot more complicated.
                 *
-                * We use the alphanumeric sorting property of the filenames to decide
-                * which ones are earlier than the exclusiveCleanupFileName file.
-                * Note that this means files are not removed in the order they were 
-                * originally written, in case this worries you.
+                * We use the alphanumeric sorting property of the filenames
+                * to decide which ones are earlier than the
+                * exclusiveCleanupFileName file. Note that this means files
+                * are not removed in the order they were originally written,
+                * in case this worries you.
                 */
                if (strlen(xlde->d_name) == XLOG_DATA_FNAME_LEN &&
                    strspn(xlde->d_name, "0123456789ABCDEF") == XLOG_DATA_FNAME_LEN &&
-                   strcmp(xlde->d_name + 8, exclusiveCleanupFileName + 8) < 0)
+                 strcmp(xlde->d_name + 8, exclusiveCleanupFileName + 8) < 0)
                {
 #ifdef WIN32
                    snprintf(WALFilePath, MAXPGPATH, "%s\\%s", archiveLocation, xlde->d_name);
@@ -249,7 +252,7 @@ CustomizableCleanupPriorWALFiles(void)
 #endif
 
                    if (debug)
-                       fprintf(stderr, "\nremoving \"%s\"", WALFilePath);
+                       fprintf(stderr, "\nremoving \"%s\"", WALFilePath);
 
                    rc = unlink(WALFilePath);
                    if (rc != 0)
@@ -264,7 +267,7 @@ CustomizableCleanupPriorWALFiles(void)
                fprintf(stderr, "\n");
        }
        else
-           fprintf(stderr, "pg_standby: archiveLocation \"%s\" open error\n", archiveLocation);
+           fprintf(stderr, "pg_standby: archiveLocation \"%s\" open error\n", archiveLocation);
 
        closedir(xldir);
        fflush(stderr);
@@ -278,19 +281,19 @@ CustomizableCleanupPriorWALFiles(void)
 
 /*
  * SetWALFileNameForCleanup()
- * 
+ *
  *   Set the earliest WAL filename that we want to keep on the archive
- *    and decide whether we need_cleanup
+ *   and decide whether we need_cleanup
  */
 static bool
 SetWALFileNameForCleanup(void)
 {
-   uint32          tli = 1,
-                   log = 0,
-                   seg = 0;
-   uint32          log_diff = 0,
-                   seg_diff = 0;
-   bool            cleanup = false;
+   uint32      tli = 1,
+               log = 0,
+               seg = 0;
+   uint32      log_diff = 0,
+               seg_diff = 0;
+   bool        cleanup = false;
 
    if (restartWALFileName)
    {
@@ -305,7 +308,7 @@ SetWALFileNameForCleanup(void)
        {
            log_diff = keepfiles / MaxSegmentsPerLogFile;
            seg_diff = keepfiles % MaxSegmentsPerLogFile;
-               if (seg_diff > seg)
+           if (seg_diff > seg)
            {
                log_diff++;
                seg = MaxSegmentsPerLogFile - seg_diff;
@@ -333,31 +336,30 @@ SetWALFileNameForCleanup(void)
 
 /*
  * CheckForExternalTrigger()
- * 
+ *
  *   Is there a trigger file?
  */
-static bool 
+static bool
 CheckForExternalTrigger(void)
 {
-   int rc;
+   int         rc;
 
    /*
-    *  Look for a trigger file, if that option has been selected
+    * Look for a trigger file, if that option has been selected
     *
-    *  We use stat() here because triggerPath is always a file
-    *  rather than potentially being in an archive
+    * We use stat() here because triggerPath is always a file rather than
+    * potentially being in an archive
     */
    if (triggerPath && stat(triggerPath, &stat_buf) == 0)
    {
-       fprintf(stderr, "trigger file found\n");
+       fprintf(stderr, "trigger file found\n");
        fflush(stderr);
 
        /*
-        * If trigger file found, we *must* delete it. Here's why:
-        * When recovery completes, we will be asked again
-        * for the same file from the archive using pg_standby
-        * so must remove trigger file so we can reload file again
-        * and come up correctly.
+        * If trigger file found, we *must* delete it. Here's why: When
+        * recovery completes, we will be asked again for the same file from
+        * the archive using pg_standby so must remove trigger file so we can
+        * reload file again and come up correctly.
         */
        rc = unlink(triggerPath);
        if (rc != 0)
@@ -374,14 +376,14 @@ CheckForExternalTrigger(void)
 
 /*
  * RestoreWALFileForRecovery()
- * 
+ *
  *   Perform the action required to restore the file from archive
  */
 static bool
 RestoreWALFileForRecovery(void)
 {
-   int rc = 0;
-   int numretries = 0;
+   int         rc = 0;
+   int         numretries = 0;
 
    if (debug)
    {
@@ -401,7 +403,7 @@ RestoreWALFileForRecovery(void)
            }
            return true;
        }
-        pg_usleep(numretries++ * sleeptime * 1000000L);
+       pg_usleep(numretries++ * sleeptime * 1000000L);
    }
 
    /*
@@ -441,13 +443,13 @@ sighandler(int sig)
 }
 
 /*------------ MAIN ----------------------------------------*/
-int 
+int
 main(int argc, char **argv)
 {
    int         c;
 
-   (void) signal(SIGINT,   sighandler);
-   (void) signal(SIGQUIT,  sighandler);
+   (void) signal(SIGINT, sighandler);
+   (void) signal(SIGQUIT, sighandler);
 
    while ((c = getopt(argc, argv, "cdk:lr:s:t:w:")) != -1)
    {
@@ -492,8 +494,8 @@ main(int argc, char **argv)
            case 't':           /* Trigger file */
                triggerPath = optarg;
                if (CheckForExternalTrigger())
-                   exit(1);     /* Normal exit, with non-zero */
-                   break;
+                   exit(1);    /* Normal exit, with non-zero */
+               break;
            case 'w':           /* Max wait time */
                maxwaittime = atoi(optarg);
                if (maxwaittime < 0)
@@ -510,7 +512,7 @@ main(int argc, char **argv)
        }
    }
 
-   /* 
+   /*
     * Parameter checking - after checking to see if trigger file present
     */
    if (argc == 1)
@@ -521,8 +523,8 @@ main(int argc, char **argv)
 
    /*
     * We will go to the archiveLocation to get nextWALFileName.
-    * nextWALFileName may not exist yet, which would not be an error,
-    * so we separate the archiveLocation and nextWALFileName so we can check
+    * nextWALFileName may not exist yet, which would not be an error, so we
+    * separate the archiveLocation and nextWALFileName so we can check
     * separately whether archiveLocation exists, if not that is an error
     */
    if (optind < argc)
@@ -532,7 +534,7 @@ main(int argc, char **argv)
    }
    else
    {
-       fprintf(stderr, "pg_standby: must specify archiveLocation\n");
+       fprintf(stderr, "pg_standby: must specify archiveLocation\n");
        usage();
        exit(2);
    }
@@ -544,7 +546,7 @@ main(int argc, char **argv)
    }
    else
    {
-       fprintf(stderr, "pg_standby: use %%f to specify nextWALFileName\n");
+       fprintf(stderr, "pg_standby: use %%f to specify nextWALFileName\n");
        usage();
        exit(2);
    }
@@ -556,7 +558,7 @@ main(int argc, char **argv)
    }
    else
    {
-       fprintf(stderr, "pg_standby: use %%p to specify xlogFilePath\n");
+       fprintf(stderr, "pg_standby: use %%p to specify xlogFilePath\n");
        usage();
        exit(2);
    }
@@ -573,14 +575,14 @@ main(int argc, char **argv)
 
    if (debug)
    {
-        fprintf(stderr, "\nTrigger file        : %s", triggerPath ? triggerPath : "<not set>");
-       fprintf(stderr, "\nWaiting for WAL file : %s", nextWALFileName);
-       fprintf(stderr, "\nWAL file path        : %s", WALFilePath);
-       fprintf(stderr, "\nRestoring to...      : %s", xlogFilePath);
-       fprintf(stderr, "\nSleep interval       : %d second%s", 
-                   sleeptime, (sleeptime > 1 ? "s" : " "));
-       fprintf(stderr, "\nMax wait interval    : %d %s", 
-                   maxwaittime, (maxwaittime > 0 ? "seconds" : "forever"));
+       fprintf(stderr, "\nTrigger file         : %s", triggerPath ? triggerPath : "<not set>");
+       fprintf(stderr, "\nWaiting for WAL file : %s", nextWALFileName);
+       fprintf(stderr, "\nWAL file path        : %s", WALFilePath);
+       fprintf(stderr, "\nRestoring to...      : %s", xlogFilePath);
+       fprintf(stderr, "\nSleep interval       : %d second%s",
+               sleeptime, (sleeptime > 1 ? "s" : " "));
+       fprintf(stderr, "\nMax wait interval    : %d %s",
+               maxwaittime, (maxwaittime > 0 ? "seconds" : "forever"));
        fprintf(stderr, "\nCommand for restore  : %s", restoreCommand);
        fprintf(stderr, "\nKeep archive history : %s and later", exclusiveCleanupFileName);
        fflush(stderr);
@@ -609,20 +611,20 @@ main(int argc, char **argv)
        }
    }
 
-   /* 
+   /*
     * Main wait loop
     */
    while (!CustomizableNextWALFileReady() && !triggered)
    {
        if (sleeptime <= 60)
-           pg_usleep(sleeptime * 1000000L);
+           pg_usleep(sleeptime * 1000000L);
 
        if (signaled)
        {
            triggered = true;
            if (debug)
            {
-               fprintf(stderr, "\nsignaled to exit\n");
+               fprintf(stderr, "\nsignaled to exit\n");
                fflush(stderr);
            }
        }
@@ -631,36 +633,34 @@ main(int argc, char **argv)
 
            if (debug)
            {
-               fprintf(stderr, "\nWAL file not present yet.");
+               fprintf(stderr, "\nWAL file not present yet.");
                if (triggerPath)
-                   fprintf(stderr, " Checking for trigger file...");
+                   fprintf(stderr, " Checking for trigger file...");
                fflush(stderr);
            }
 
            waittime += sleeptime;
-           
+
            if (!triggered && (CheckForExternalTrigger() || (waittime >= maxwaittime && maxwaittime > 0)))
            {
                triggered = true;
                if (debug && waittime >= maxwaittime && maxwaittime > 0)
-                   fprintf(stderr, "\nTimed out after %d seconds\n",waittime);
+                   fprintf(stderr, "\nTimed out after %d seconds\n", waittime);
            }
        }
    }
 
-   /* 
-    * Action on exit 
+   /*
+    * Action on exit
     */
    if (triggered)
-       exit(1);            /* Normal exit, with non-zero */
-
-   /* 
-    * Once we have restored this file successfully we
-    * can remove some prior WAL files.
-    * If this restore fails we musn't remove any
-    * file because some of them will be requested again
-    * immediately after the failed restore, or when
-    * we restart recovery.
+       exit(1);                /* Normal exit, with non-zero */
+
+   /*
+    * Once we have restored this file successfully we can remove some prior
+    * WAL files. If this restore fails we musn't remove any file because some
+    * of them will be requested again immediately after the failed restore,
+    * or when we restart recovery.
     */
    if (RestoreWALFileForRecovery() && need_cleanup)
        CustomizableCleanupPriorWALFiles();
index ed2ba0eae759e9f70c770c405b0bba997fc910ff..33d005ae9a0aabbfa71c07b0729dc643d2d1dfc6 100644 (file)
@@ -16,23 +16,23 @@ Datum       gin_trgm_consistent(PG_FUNCTION_ARGS);
 Datum
 gin_extract_trgm(PG_FUNCTION_ARGS)
 {
-   text        *val = (text *) PG_GETARG_TEXT_P(0);
-   int32       *nentries = (int32 *) PG_GETARG_POINTER(1);
-   Datum       *entries = NULL;
-   TRGM        *trg;
+   text       *val = (text *) PG_GETARG_TEXT_P(0);
+   int32      *nentries = (int32 *) PG_GETARG_POINTER(1);
+   Datum      *entries = NULL;
+   TRGM       *trg;
    int4        trglen;
-   
+
    *nentries = 0;
-   
+
    trg = generate_trgm(VARDATA(val), VARSIZE(val) - VARHDRSZ);
    trglen = ARRNELEM(trg);
-   
+
    if (trglen > 0)
    {
-       trgm    *ptr;
-       int4    i = 0,
-               item;
-       
+       trgm       *ptr;
+       int4        i = 0,
+                   item;
+
        *nentries = (int32) trglen;
        entries = (Datum *) palloc(sizeof(Datum) * trglen);
 
@@ -41,7 +41,7 @@ gin_extract_trgm(PG_FUNCTION_ARGS)
        {
            item = TRGMINT(ptr);
            entries[i++] = Int32GetDatum(item);
-           
+
            ptr++;
        }
    }
@@ -52,20 +52,20 @@ gin_extract_trgm(PG_FUNCTION_ARGS)
 Datum
 gin_trgm_consistent(PG_FUNCTION_ARGS)
 {
-   bool        *check = (bool *) PG_GETARG_POINTER(0);
-   text        *query = (text *) PG_GETARG_TEXT_P(2);
+   bool       *check = (bool *) PG_GETARG_POINTER(0);
+   text       *query = (text *) PG_GETARG_TEXT_P(2);
    bool        res = FALSE;
-   TRGM        *trg;
+   TRGM       *trg;
    int4        i,
                trglen,
                ntrue = 0;
-   
+
    trg = generate_trgm(VARDATA(query), VARSIZE(query) - VARHDRSZ);
    trglen = ARRNELEM(trg);
-   
+
    for (i = 0; i < trglen; i++)
        if (check[i])
-           ntrue ++;
+           ntrue++;
 
 #ifdef DIVUNION
    res = (trglen == ntrue) ? true : ((((((float4) ntrue) / ((float4) (trglen - ntrue)))) >= trgm_limit) ? true : false);
index a5e57ce9550ac8ef2c179de0dbd5da047cf9d30a..5fe48b96a3d642fcadd0de6bc0dd1400c73f2d75 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.73 2007/10/22 10:40:47 mha Exp $
+ * $PostgreSQL: pgsql/contrib/pgbench/pgbench.c,v 1.74 2007/11/15 21:14:31 momjian Exp $
  *
  * pgbench: a simple benchmark program for PostgreSQL
  * written by Tatsuo Ishii
@@ -53,9 +53,9 @@ extern int    optind;
 
 /* max number of clients allowed */
 #ifdef FD_SETSIZE
-#define MAXCLIENTS     (FD_SETSIZE - 10)
+#define MAXCLIENTS (FD_SETSIZE - 10)
 #else
-#define MAXCLIENTS     1024
+#define MAXCLIENTS 1024
 #endif
 
 int            nclients = 1;       /* default number of simulated clients */
@@ -201,7 +201,7 @@ getrand(int min, int max)
 
 /* call PQexec() and exit() on failure */
 static void
-executeStatement(PGconn *con, const charsql)
+executeStatement(PGconn *con, const char *sql)
 {
    PGresult   *res;
 
@@ -262,7 +262,7 @@ discard_response(CState * state)
 
 /* check to see if the SQL result was good */
 static int
-check(CState *state, PGresult *res, int n)
+check(CState * state, PGresult *res, int n)
 {
    CState     *st = &state[n];
 
@@ -275,7 +275,7 @@ check(CState *state, PGresult *res, int n)
        default:
            fprintf(stderr, "Client %d aborted in state %d: %s",
                    n, st->state, PQerrorMessage(st->con));
-           remains--;              /* I've aborted */
+           remains--;          /* I've aborted */
            PQfinish(st->con);
            st->con = NULL;
            return (-1);
@@ -452,12 +452,12 @@ top:
 
    if (st->sleeping)
    {                           /* are we sleeping? */
-       int             usec;
-       struct timeval  now;
+       int         usec;
+       struct timeval now;
 
        gettimeofday(&now, NULL);
        usec = (st->until.tv_sec - now.tv_sec) * 1000000 +
-               st->until.tv_usec - now.tv_usec;
+           st->until.tv_usec - now.tv_usec;
        if (usec <= 0)
            st->sleeping = 0;   /* Done sleeping, go ahead with next command */
        else
@@ -798,11 +798,11 @@ init(void)
        "drop table if exists accounts",
        "create table accounts(aid int not null,bid int,abalance int,filler char(84)) with (fillfactor=%d)",
        "drop table if exists history",
-       "create table history(tid int,bid int,aid int,delta int,mtime timestamp,filler char(22))"};
+   "create table history(tid int,bid int,aid int,delta int,mtime timestamp,filler char(22))"};
    static char *DDLAFTERs[] = {
        "alter table branches add primary key (bid)",
        "alter table tellers add primary key (tid)",
-       "alter table accounts add primary key (aid)"};
+   "alter table accounts add primary key (aid)"};
 
 
    char        sql[256];
@@ -821,7 +821,8 @@ init(void)
            (strstr(DDLs[i], "create table tellers") == DDLs[i]) ||
            (strstr(DDLs[i], "create table accounts") == DDLs[i]))
        {
-           char ddl_stmt[128];
+           char        ddl_stmt[128];
+
            snprintf(ddl_stmt, 128, DDLs[i], fillfactor);
            executeStatement(con, ddl_stmt);
            continue;
@@ -990,7 +991,7 @@ process_commands(char *buf)
                    pg_strcasecmp(my_commands->argv[2], "ms") != 0 &&
                    pg_strcasecmp(my_commands->argv[2], "s"))
                {
-                   fprintf(stderr, "%s: unknown time unit '%s' - must be us, ms or s\n", 
+                   fprintf(stderr, "%s: unknown time unit '%s' - must be us, ms or s\n",
                            my_commands->argv[0], my_commands->argv[2]);
                    return NULL;
                }
@@ -1204,7 +1205,7 @@ main(int argc, char **argv)
    int         c;
    int         is_init_mode = 0;       /* initialize mode? */
    int         is_no_vacuum = 0;       /* no vacuum at all before testing? */
-   int         do_vacuum_accounts = 0; /* do vacuum accounts before testing? */
+   int         do_vacuum_accounts = 0; /* do vacuum accounts before testing? */
    int         debug = 0;      /* debug flag */
    int         ttype = 0;      /* transaction type. 0: TPC-B, 1: SELECT only,
                                 * 2: skip update of branches and tellers */
@@ -1308,7 +1309,7 @@ main(int argc, char **argv)
                    fprintf(stderr, "Use limit/ulimit to increase the limit before using pgbench.\n");
                    exit(1);
                }
-#endif /* HAVE_GETRLIMIT */
+#endif   /* HAVE_GETRLIMIT */
                break;
            case 'C':
                is_connect = 1;
@@ -1615,8 +1616,8 @@ main(int argc, char **argv)
 
            if (state[i].sleeping)
            {
-               int     this_usec;
-               int     sock = PQsocket(state[i].con);
+               int         this_usec;
+               int         sock = PQsocket(state[i].con);
 
                if (min_usec < 0)
                {
@@ -1625,7 +1626,7 @@ main(int argc, char **argv)
                }
 
                this_usec = (state[i].until.tv_sec - now.tv_sec) * 1000000 +
-                           state[i].until.tv_usec - now.tv_usec;
+                   state[i].until.tv_usec - now.tv_usec;
 
                if (this_usec > 0 && (min_usec == 0 || this_usec < min_usec))
                    min_usec = this_usec;
@@ -1657,11 +1658,11 @@ main(int argc, char **argv)
                timeout.tv_usec = min_usec % 1000000;
 
                nsocks = select(maxsock + 1, &input_mask, (fd_set *) NULL,
-                             (fd_set *) NULL, &timeout);
+                               (fd_set *) NULL, &timeout);
            }
            else
                nsocks = select(maxsock + 1, &input_mask, (fd_set *) NULL,
-                             (fd_set *) NULL, (struct timeval *) NULL);
+                               (fd_set *) NULL, (struct timeval *) NULL);
            if (nsocks < 0)
            {
                if (errno == EINTR)
index 93a6183fcad35e5b2ff1e05daeeb987fd8770b56..7138ffa90332e8fc5f97902326886aae6cc24176 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Butchered version of sshblowf.c from putty-0.59.
  *
- * $PostgreSQL: pgsql/contrib/pgcrypto/blf.c,v 1.8 2007/03/28 22:48:58 neilc Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/blf.c,v 1.9 2007/11/15 21:14:31 momjian Exp $
  */
 
 /*
@@ -251,7 +251,7 @@ static const uint32 sbox3[] = {
 
 static void
 blowfish_encrypt(uint32 xL, uint32 xR, uint32 *output,
-                BlowfishContext *ctx)
+                BlowfishContext * ctx)
 {
    uint32     *S0 = ctx->S0;
    uint32     *S1 = ctx->S1;
@@ -285,7 +285,7 @@ blowfish_encrypt(uint32 xL, uint32 xR, uint32 *output,
 
 static void
 blowfish_decrypt(uint32 xL, uint32 xR, uint32 *output,
-                BlowfishContext *ctx)
+                BlowfishContext * ctx)
 {
    uint32     *S0 = ctx->S0;
    uint32     *S1 = ctx->S1;
@@ -318,7 +318,7 @@ blowfish_decrypt(uint32 xL, uint32 xR, uint32 *output,
 }
 
 void
-blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx)
+blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext * ctx)
 {
    uint32      xL,
                xR,
@@ -351,7 +351,7 @@ blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx)
 }
 
 void
-blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx)
+blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext * ctx)
 {
    uint32      xL,
                xR,
@@ -384,7 +384,7 @@ blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx)
 }
 
 void
-blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx)
+blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext * ctx)
 {
    uint32      xL,
                xR,
@@ -405,7 +405,7 @@ blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx)
 }
 
 void
-blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx)
+blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext * ctx)
 {
    uint32      xL,
                xR,
@@ -426,7 +426,7 @@ blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx)
 }
 
 void
-blowfish_setkey(BlowfishContext *ctx,
+blowfish_setkey(BlowfishContext * ctx,
                const uint8 *key, short keybytes)
 {
    uint32     *S0 = ctx->S0;
@@ -437,7 +437,7 @@ blowfish_setkey(BlowfishContext *ctx,
    uint32      str[2];
    int         i;
 
-   Assert(keybytes > 0 && keybytes <= (448/8));
+   Assert(keybytes > 0 && keybytes <= (448 / 8));
 
    for (i = 0; i < 18; i++)
    {
@@ -492,9 +492,8 @@ blowfish_setkey(BlowfishContext *ctx,
 }
 
 void
-blowfish_setiv(BlowfishContext *ctx, const uint8 *iv)
+blowfish_setiv(BlowfishContext * ctx, const uint8 *iv)
 {
    ctx->iv0 = GET_32BIT_MSB_FIRST(iv);
    ctx->iv1 = GET_32BIT_MSB_FIRST(iv + 4);
 }
-
index 7e11dc9aeb4853a2cc6695379170844ebbad5e63..6e280d8754fee3cc6dff9c99304092e2215decf2 100644 (file)
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/contrib/pgcrypto/blf.h,v 1.6 2007/03/28 22:48:58 neilc Exp $ */
+/* $PostgreSQL: pgsql/contrib/pgcrypto/blf.h,v 1.7 2007/11/15 21:14:31 momjian Exp $ */
 /*
  * PuTTY is copyright 1997-2007 Simon Tatham.
  *
@@ -35,14 +35,12 @@ typedef struct
                S3[256],
                P[18];
    uint32      iv0,
-               iv1;            /* for CBC mode */
-} BlowfishContext;
-
-void blowfish_setkey(BlowfishContext *ctx, const uint8 *key, short keybytes);
-void blowfish_setiv(BlowfishContext *ctx, const uint8 *iv);
-void blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx);
-void blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext *ctx);
-void blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx);
-void blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext *ctx);
-
+               iv1;            /* for CBC mode */
+}  BlowfishContext;
 
+void       blowfish_setkey(BlowfishContext * ctx, const uint8 *key, short keybytes);
+void       blowfish_setiv(BlowfishContext * ctx, const uint8 *iv);
+void       blowfish_encrypt_cbc(uint8 *blk, int len, BlowfishContext * ctx);
+void       blowfish_decrypt_cbc(uint8 *blk, int len, BlowfishContext * ctx);
+void       blowfish_encrypt_ecb(uint8 *blk, int len, BlowfishContext * ctx);
+void       blowfish_decrypt_ecb(uint8 *blk, int len, BlowfishContext * ctx);
index f951f2c411cfee210344a64137ae88c971c118b2..84b4d758af16f5d65060de1ae72d84a551877dad 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $PostgreSQL: pgsql/contrib/pgcrypto/crypt-blowfish.c,v 1.12 2007/04/06 05:36:50 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/crypt-blowfish.c,v 1.13 2007/11/15 21:14:31 momjian Exp $
  *
  * This code comes from John the Ripper password cracker, with reentrant
  * and crypt(3) interfaces added, but optimizations specific to password
@@ -436,7 +436,7 @@ BF_encode(char *dst, const BF_word * src, int size)
 }
 
 static void
-BF_swap(BF_word *x, int count)
+BF_swap(BF_word * x, int count)
 {
    /* Swap on little-endian hardware, else do nothing */
 #ifndef WORDS_BIGENDIAN
index f730b320506a476dea59e777b8ce5d6038e170de..5bc335e582021e3b38912aa4b32a027ba7640e99 100644 (file)
@@ -26,7 +26,7 @@
   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   SOFTWARE.
  */
-/* $PostgreSQL: pgsql/contrib/pgcrypto/imath.h,v 1.5 2006/10/04 00:29:46 momjian Exp $ */
+/* $PostgreSQL: pgsql/contrib/pgcrypto/imath.h,v 1.6 2007/11/15 21:14:31 momjian Exp $ */
 
 #ifndef IMATH_H_
 #define IMATH_H_
@@ -115,11 +115,12 @@ mp_result mp_int_mul(mp_int a, mp_int b, mp_int c);   /* c = a * b */
 mp_result  mp_int_mul_value(mp_int a, int value, mp_int c);
 mp_result  mp_int_mul_pow2(mp_int a, int p2, mp_int c);
 mp_result  mp_int_sqr(mp_int a, mp_int c);     /* c = a * a */
+
 mp_result
-mp_int_div(mp_int a, mp_int b, /* q = a / b */
+mp_int_div(mp_int a, mp_int b,         /* q = a / b */
           mp_int q, mp_int r); /* r = a % b */
 mp_result
-mp_int_div_value(mp_int a, int value,  /* q = a / value */
+mp_int_div_value(mp_int a, int value,          /* q = a / value */
                 mp_int q, int *r);     /* r = a % value */
 mp_result
 mp_int_div_pow2(mp_int a, int p2,      /* q = a / 2^p2  */
index 24db7c0cc83337680251d1bb58a50c6f4a18dc16..594308673bc513bd412432ae0d2663358542ff3c 100644 (file)
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $PostgreSQL: pgsql/contrib/pgcrypto/internal.c,v 1.26 2007/03/28 22:48:58 neilc Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/internal.c,v 1.27 2007/11/15 21:14:31 momjian Exp $
  */
 
 #include "postgres.h"
@@ -251,7 +251,7 @@ struct int_ctx
    uint8       iv[INT_MAX_IV];
    union
    {
-       BlowfishContext     bf;
+       BlowfishContext bf;
        rijndael_ctx rj;
    }           ctx;
    unsigned    keylen;
@@ -426,7 +426,7 @@ bf_block_size(PX_Cipher * c)
 static unsigned
 bf_key_size(PX_Cipher * c)
 {
-   return 448/8;
+   return 448 / 8;
 }
 
 static unsigned
index 10df87f2bf5af21ab89c6476e982d6c97074ca82..0f46580005d8476100dfe94bb9c9165afa74c0f5 100644 (file)
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $PostgreSQL: pgsql/contrib/pgcrypto/openssl.c,v 1.31 2007/09/29 02:18:15 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/openssl.c,v 1.32 2007/11/15 21:14:31 momjian Exp $
  */
 
 #include "postgres.h"
@@ -98,10 +98,13 @@ static void
 AES_cbc_encrypt(const uint8 *src, uint8 *dst, int len, AES_KEY *ctx, uint8 *iv, int enc)
 {
    memcpy(dst, src, len);
-   if (enc) {
+   if (enc)
+   {
        aes_cbc_encrypt(ctx, iv, dst, len);
        memcpy(iv, dst + len - 16, 16);
-   } else {
+   }
+   else
+   {
        aes_cbc_decrypt(ctx, iv, dst, len);
        memcpy(iv, src + len - 16, 16);
    }
@@ -394,26 +397,27 @@ static int
 bf_check_supported_key_len(void)
 {
    static const uint8 key[56] = {
-       0xf0,0xe1,0xd2,0xc3,0xb4,0xa5,0x96,0x87,0x78,0x69,
-       0x5a,0x4b,0x3c,0x2d,0x1e,0x0f,0x00,0x11,0x22,0x33,
-       0x44,0x55,0x66,0x77,0x04,0x68,0x91,0x04,0xc2,0xfd,
-       0x3b,0x2f,0x58,0x40,0x23,0x64,0x1a,0xba,0x61,0x76,
-       0x1f,0x1f,0x1f,0x1f,0x0e,0x0e,0x0e,0x0e,0xff,0xff,
-       0xff,0xff,0xff,0xff,0xff,0xff
+       0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, 0x78, 0x69,
+       0x5a, 0x4b, 0x3c, 0x2d, 0x1e, 0x0f, 0x00, 0x11, 0x22, 0x33,
+       0x44, 0x55, 0x66, 0x77, 0x04, 0x68, 0x91, 0x04, 0xc2, 0xfd,
+       0x3b, 0x2f, 0x58, 0x40, 0x23, 0x64, 0x1a, 0xba, 0x61, 0x76,
+       0x1f, 0x1f, 0x1f, 0x1f, 0x0e, 0x0e, 0x0e, 0x0e, 0xff, 0xff,
+       0xff, 0xff, 0xff, 0xff, 0xff, 0xff
    };
 
-   static const uint8 data[8] = {0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10};
-   static const uint8 res[8] = {0xc0,0x45,0x04,0x01,0x2e,0x4e,0x1f,0x53};
+   static const uint8 data[8] = {0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10};
+   static const uint8 res[8] = {0xc0, 0x45, 0x04, 0x01, 0x2e, 0x4e, 0x1f, 0x53};
    static uint8 out[8];
 
-   BF_KEY bf_key;
+   BF_KEY      bf_key;
 
    /* encrypt with 448bits key and verify output */
    BF_set_key(&bf_key, 56, key);
    BF_ecb_encrypt(data, out, &bf_key, BF_ENCRYPT);
 
-   if (memcmp(out, res, 8) != 0)   
-       return 0;   /* Output does not match -> strong cipher is not supported */ 
+   if (memcmp(out, res, 8) != 0)
+       return 0;               /* Output does not match -> strong cipher is
+                                * not supported */
    return 1;
 }
 
@@ -421,18 +425,19 @@ static int
 bf_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv)
 {
    ossldata   *od = c->ptr;
-   static int bf_is_strong = -1;
+   static int  bf_is_strong = -1;
 
    /*
-    * Test if key len is supported. BF_set_key silently cut large keys and it could be
-    * be a problem when user transfer crypted data from one server to another.
+    * Test if key len is supported. BF_set_key silently cut large keys and it
+    * could be be a problem when user transfer crypted data from one server
+    * to another.
     */
-   
-   ifbf_is_strong == -1)
+
+   if (bf_is_strong == -1)
        bf_is_strong = bf_check_supported_key_len();
 
-   if( !bf_is_strong && klen>16 )
-       return PXE_KEY_TOO_BIG; 
+   if (!bf_is_strong && klen > 16)
+       return PXE_KEY_TOO_BIG;
 
    /* Key len is supported. We can use it. */
    BF_set_key(&od->u.bf.key, klen, key);
@@ -750,13 +755,14 @@ ossl_aes_init(PX_Cipher * c, const uint8 *key, unsigned klen, const uint8 *iv)
 static int
 ossl_aes_key_init(ossldata * od, int type)
 {
-   int err;
+   int         err;
+
    /*
-    * Strong key support could be missing on some openssl installations.
-    * We must check return value from set key function.
-    */ 
+    * Strong key support could be missing on some openssl installations. We
+    * must check return value from set key function.
+    */
    if (type == AES_ENCRYPT)
-       err = AES_set_encrypt_key(od->key, od->klen * 8, &od->u.aes_key);
+       err = AES_set_encrypt_key(od->key, od->klen * 8, &od->u.aes_key);
    else
        err = AES_set_decrypt_key(od->key, od->klen * 8, &od->u.aes_key);
 
@@ -776,7 +782,7 @@ ossl_aes_ecb_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
    unsigned    bs = gen_ossl_block_size(c);
    ossldata   *od = c->ptr;
    const uint8 *end = data + dlen - bs;
-   int err;
+   int         err;
 
    if (!od->init)
        if ((err = ossl_aes_key_init(od, AES_ENCRYPT)) != 0)
@@ -794,7 +800,7 @@ ossl_aes_ecb_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
    unsigned    bs = gen_ossl_block_size(c);
    ossldata   *od = c->ptr;
    const uint8 *end = data + dlen - bs;
-   int err;
+   int         err;
 
    if (!od->init)
        if ((err = ossl_aes_key_init(od, AES_DECRYPT)) != 0)
@@ -810,12 +816,12 @@ ossl_aes_cbc_encrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
                     uint8 *res)
 {
    ossldata   *od = c->ptr;
-   int err;
+   int         err;
 
    if (!od->init)
        if ((err = ossl_aes_key_init(od, AES_ENCRYPT)) != 0)
            return err;
-   
+
    AES_cbc_encrypt(data, res, dlen, &od->u.aes_key, od->iv, AES_ENCRYPT);
    return 0;
 }
@@ -825,7 +831,7 @@ ossl_aes_cbc_decrypt(PX_Cipher * c, const uint8 *data, unsigned dlen,
                     uint8 *res)
 {
    ossldata   *od = c->ptr;
-   int err;
+   int         err;
 
    if (!od->init)
        if ((err = ossl_aes_key_init(od, AES_DECRYPT)) != 0)
index 2942edf2ad1677a2e546c5dd4ffb8e4411f48bdd..9d2f61ed8ed3163304cc6e584541a61d13e420bb 100644 (file)
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-compress.c,v 1.6 2007/01/14 20:55:14 alvherre Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/pgp-compress.c,v 1.7 2007/11/15 21:14:31 momjian Exp $
  */
 
 #include "postgres.h"
@@ -312,7 +312,6 @@ pgp_decompress_filter(PullFilter ** res, PGP_Context * ctx, PullFilter * src)
 {
    return pullf_create(res, &decompress_filter, ctx, src);
 }
-
 #else                          /* !HAVE_ZLIB */
 
 int
index 81222873b698cc033793a514f76e698697b6a0a8..d1b22d7ec7fc3a51359015b9aa025715d2fa62c1 100644 (file)
@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $PostgreSQL: pgsql/contrib/pgcrypto/px.c,v 1.16 2007/08/23 16:15:51 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/px.c,v 1.17 2007/11/15 21:14:31 momjian Exp $
  */
 
 #include "postgres.h"
@@ -286,7 +286,7 @@ combo_decrypt(PX_Combo * cx, const uint8 *data, unsigned dlen,
        /* with padding, empty ciphertext is not allowed */
        if (cx->padding)
            return PXE_DECRYPT_FAILED;
-       
+
        /* without padding, report empty result */
        *rlen = 0;
        return 0;
index e25f35acdef76792940243705d2a57a94c9c59ee..c2e9da965b9ec7a4bf633d0d70b8ee9edabec7fa 100644 (file)
@@ -33,7 +33,7 @@
  *
  * $From: sha2.c,v 1.1 2001/11/08 00:01:51 adg Exp adg $
  *
- * $PostgreSQL: pgsql/contrib/pgcrypto/sha2.c,v 1.9 2007/04/06 05:36:50 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/pgcrypto/sha2.c,v 1.10 2007/11/15 21:14:31 momjian Exp $
  */
 
 #include "postgres.h"
@@ -78,7 +78,7 @@
    (x) = ((tmp & 0xffff0000ffff0000ULL) >> 16) | \
          ((tmp & 0x0000ffff0000ffffULL) << 16); \
 }
-#endif /* not bigendian */
+#endif   /* not bigendian */
 
 /*
  * Macro for incrementally adding the unsigned 64-bit integer n to the
index 3018b6aedd1c54e7e42b9c7c576245243c3163ac..3cd31478956f2c6bd5e353f085c60b1d3f0faacb 100644 (file)
@@ -159,16 +159,17 @@ pgstatindex(PG_FUNCTION_ARGS)
 
        else if (P_ISLEAF(opaque))
        {
-           int max_avail;
-           max_avail = BLCKSZ - (BLCKSZ - ((PageHeader)page)->pd_special + SizeOfPageHeaderData);
+           int         max_avail;
+
+           max_avail = BLCKSZ - (BLCKSZ - ((PageHeader) page)->pd_special + SizeOfPageHeaderData);
            indexStat.max_avail += max_avail;
            indexStat.free_space += PageGetFreeSpace(page);
 
            indexStat.leaf_pages++;
 
            /*
-            * If the next leaf is on an earlier block, it
-            * means a fragmentation.
+            * If the next leaf is on an earlier block, it means a
+            * fragmentation.
             */
            if (opaque->btpo_next != P_NONE && opaque->btpo_next < blkno)
                indexStat.fragments++;
index 22dc2f2e0ebd8fb056cfb94ac8fcbaf283cf0c4d..fd7cafea4b5755a3f78be76cf39da86e0c40b4ef 100644 (file)
@@ -552,8 +552,8 @@ crosstab(PG_FUNCTION_ARGS)
                    xpstrdup(values[0], rowid);
 
                    /*
-                    * Check to see if the rowid is the same as that of the last
-                    * tuple sent -- if so, skip this tuple entirely
+                    * Check to see if the rowid is the same as that of the
+                    * last tuple sent -- if so, skip this tuple entirely
                     */
                    if (!firstpass && xstreq(lastrowid, rowid))
                    {
@@ -563,8 +563,8 @@ crosstab(PG_FUNCTION_ARGS)
                }
 
                /*
-                * If rowid hasn't changed on us, continue building the
-                * ouput tuple.
+                * If rowid hasn't changed on us, continue building the ouput
+                * tuple.
                 */
                if (xstreq(rowid, values[0]))
                {
index 728bf4098fe9ab1decb0857a5431c11a9d39cb60..784d2d43ad02606f311cfd3f00efb277f90bf77f 100644 (file)
@@ -6,7 +6,7 @@
  * Copyright (c) 2007, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/contrib/test_parser/test_parser.c,v 1.1 2007/10/15 21:36:50 tgl Exp $
+ *   $PostgreSQL: pgsql/contrib/test_parser/test_parser.c,v 1.2 2007/11/15 21:14:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -22,40 +22,44 @@ PG_MODULE_MAGIC;
  */
 
 /* self-defined type */
-typedef struct {
-   char *  buffer; /* text to parse */
-   int     len;    /* length of the text in buffer */
-   int     pos;    /* position of the parser */
-} ParserState;
+typedef struct
+{
+   char       *buffer;         /* text to parse */
+   int         len;            /* length of the text in buffer */
+   int         pos;            /* position of the parser */
+}  ParserState;
 
 /* copy-paste from wparser.h of tsearch2 */
-typedef struct {
-   int     lexid;
-   char    *alias;
-   char    *descr;
-} LexDescr;
+typedef struct
+{
+   int         lexid;
+   char       *alias;
+   char       *descr;
+}  LexDescr;
 
 /*
  * prototypes
  */
 PG_FUNCTION_INFO_V1(testprs_start);
-Datum testprs_start(PG_FUNCTION_ARGS);
+Datum      testprs_start(PG_FUNCTION_ARGS);
 
 PG_FUNCTION_INFO_V1(testprs_getlexeme);
-Datum testprs_getlexeme(PG_FUNCTION_ARGS);
+Datum      testprs_getlexeme(PG_FUNCTION_ARGS);
 
 PG_FUNCTION_INFO_V1(testprs_end);
-Datum testprs_end(PG_FUNCTION_ARGS);
+Datum      testprs_end(PG_FUNCTION_ARGS);
 
 PG_FUNCTION_INFO_V1(testprs_lextype);
-Datum testprs_lextype(PG_FUNCTION_ARGS);
+Datum      testprs_lextype(PG_FUNCTION_ARGS);
 
 /*
  * functions
  */
-Datum testprs_start(PG_FUNCTION_ARGS)
+Datum
+testprs_start(PG_FUNCTION_ARGS)
 {
    ParserState *pst = (ParserState *) palloc0(sizeof(ParserState));
+
    pst->buffer = (char *) PG_GETARG_POINTER(0);
    pst->len = PG_GETARG_INT32(1);
    pst->pos = 0;
@@ -63,15 +67,16 @@ Datum testprs_start(PG_FUNCTION_ARGS)
    PG_RETURN_POINTER(pst);
 }
 
-Datum testprs_getlexeme(PG_FUNCTION_ARGS)
+Datum
+testprs_getlexeme(PG_FUNCTION_ARGS)
 {
-   ParserState *pst   = (ParserState *) PG_GETARG_POINTER(0);
-   char        **t    = (char **) PG_GETARG_POINTER(1);
-   int         *tlen  = (int *) PG_GETARG_POINTER(2);
+   ParserState *pst = (ParserState *) PG_GETARG_POINTER(0);
+   char      **t = (char **) PG_GETARG_POINTER(1);
+   int        *tlen = (int *) PG_GETARG_POINTER(2);
    int         type;
 
    *tlen = pst->pos;
-   *t = pst->buffer +  pst->pos;
+   *t = pst->buffer + pst->pos;
 
    if ((pst->buffer)[pst->pos] == ' ')
    {
@@ -81,7 +86,9 @@ Datum testprs_getlexeme(PG_FUNCTION_ARGS)
        while ((pst->buffer)[pst->pos] == ' ' &&
               pst->pos < pst->len)
            (pst->pos)++;
-   } else {
+   }
+   else
+   {
        /* word type */
        type = 3;
        /* go to the next white-space character */
@@ -94,28 +101,29 @@ Datum testprs_getlexeme(PG_FUNCTION_ARGS)
 
    /* we are finished if (*tlen == 0) */
    if (*tlen == 0)
-       type=0;
+       type = 0;
 
    PG_RETURN_INT32(type);
 }
 
-Datum testprs_end(PG_FUNCTION_ARGS)
+Datum
+testprs_end(PG_FUNCTION_ARGS)
 {
    ParserState *pst = (ParserState *) PG_GETARG_POINTER(0);
+
    pfree(pst);
    PG_RETURN_VOID();
 }
 
-Datum testprs_lextype(PG_FUNCTION_ARGS)
+Datum
+testprs_lextype(PG_FUNCTION_ARGS)
 {
    /*
-    * Remarks:
-    * - we have to return the blanks for headline reason
-    * - we use the same lexids like Teodor in the default
-    * word parser; in this way we can reuse the headline
-    * function of the default word parser.
+    * Remarks: - we have to return the blanks for headline reason - we use
+    * the same lexids like Teodor in the default word parser; in this way we
+    * can reuse the headline function of the default word parser.
     */
-   LexDescr *descr = (LexDescr *) palloc(sizeof(LexDescr) * (2+1));
+   LexDescr   *descr = (LexDescr *) palloc(sizeof(LexDescr) * (2 + 1));
 
    /* there are only two types in this parser */
    descr[0].lexid = 3;
index 25fb69752926e9c0559f15169d245c5251f48cb7..e0f0f651b8fab046a1141ac44af3c1ff4127dfb8 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/contrib/tsearch2/tsearch2.c,v 1.2 2007/11/13 22:14:50 tgl Exp $
+ *   $PostgreSQL: pgsql/contrib/tsearch2/tsearch2.c,v 1.3 2007/11/15 21:14:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -24,8 +24,8 @@
 
 PG_MODULE_MAGIC;
 
-static Oid current_dictionary_oid = InvalidOid;
-static Oid current_parser_oid = InvalidOid;
+static Oid current_dictionary_oid = InvalidOid;
+static Oid current_parser_oid = InvalidOid;
 
 /* insert given value at argument position 0 */
 #define INSERT_ARGUMENT0(argument, isnull)             \
@@ -65,27 +65,27 @@ static Oid current_parser_oid = InvalidOid;
    }                                                   \
    PG_FUNCTION_INFO_V1(name)
 
-static Oid GetCurrentDict(void);
-static Oid GetCurrentParser(void);
-
-Datum tsa_lexize_byname(PG_FUNCTION_ARGS);
-Datum tsa_lexize_bycurrent(PG_FUNCTION_ARGS);
-Datum tsa_set_curdict(PG_FUNCTION_ARGS);
-Datum tsa_set_curdict_byname(PG_FUNCTION_ARGS);
-Datum tsa_token_type_current(PG_FUNCTION_ARGS);
-Datum tsa_set_curprs(PG_FUNCTION_ARGS);
-Datum tsa_set_curprs_byname(PG_FUNCTION_ARGS);
-Datum tsa_parse_current(PG_FUNCTION_ARGS);
-Datum tsa_set_curcfg(PG_FUNCTION_ARGS);
-Datum tsa_set_curcfg_byname(PG_FUNCTION_ARGS);
-Datum tsa_to_tsvector_name(PG_FUNCTION_ARGS);
-Datum tsa_to_tsquery_name(PG_FUNCTION_ARGS);
-Datum tsa_plainto_tsquery_name(PG_FUNCTION_ARGS);
-Datum tsa_headline_byname(PG_FUNCTION_ARGS);
-Datum tsa_ts_stat(PG_FUNCTION_ARGS);
-Datum tsa_tsearch2(PG_FUNCTION_ARGS);
-Datum tsa_rewrite_accum(PG_FUNCTION_ARGS);
-Datum tsa_rewrite_finish(PG_FUNCTION_ARGS);
+static Oid GetCurrentDict(void);
+static Oid GetCurrentParser(void);
+
+Datum      tsa_lexize_byname(PG_FUNCTION_ARGS);
+Datum      tsa_lexize_bycurrent(PG_FUNCTION_ARGS);
+Datum      tsa_set_curdict(PG_FUNCTION_ARGS);
+Datum      tsa_set_curdict_byname(PG_FUNCTION_ARGS);
+Datum      tsa_token_type_current(PG_FUNCTION_ARGS);
+Datum      tsa_set_curprs(PG_FUNCTION_ARGS);
+Datum      tsa_set_curprs_byname(PG_FUNCTION_ARGS);
+Datum      tsa_parse_current(PG_FUNCTION_ARGS);
+Datum      tsa_set_curcfg(PG_FUNCTION_ARGS);
+Datum      tsa_set_curcfg_byname(PG_FUNCTION_ARGS);
+Datum      tsa_to_tsvector_name(PG_FUNCTION_ARGS);
+Datum      tsa_to_tsquery_name(PG_FUNCTION_ARGS);
+Datum      tsa_plainto_tsquery_name(PG_FUNCTION_ARGS);
+Datum      tsa_headline_byname(PG_FUNCTION_ARGS);
+Datum      tsa_ts_stat(PG_FUNCTION_ARGS);
+Datum      tsa_tsearch2(PG_FUNCTION_ARGS);
+Datum      tsa_rewrite_accum(PG_FUNCTION_ARGS);
+Datum      tsa_rewrite_finish(PG_FUNCTION_ARGS);
 
 PG_FUNCTION_INFO_V1(tsa_lexize_byname);
 PG_FUNCTION_INFO_V1(tsa_lexize_bycurrent);
@@ -150,11 +150,11 @@ UNSUPPORTED_FUNCTION(tsa_get_covers);
 Datum
 tsa_lexize_byname(PG_FUNCTION_ARGS)
 {
-   text *dictname = PG_GETARG_TEXT_P(0);
-   Datum arg1 = PG_GETARG_DATUM(1);
+   text       *dictname = PG_GETARG_TEXT_P(0);
+   Datum       arg1 = PG_GETARG_DATUM(1);
 
    return DirectFunctionCall2(ts_lexize,
-                              ObjectIdGetDatum(TextGetObjectId(regdictionaryin, dictname)),
+               ObjectIdGetDatum(TextGetObjectId(regdictionaryin, dictname)),
                               arg1);
 }
 
@@ -162,8 +162,8 @@ tsa_lexize_byname(PG_FUNCTION_ARGS)
 Datum
 tsa_lexize_bycurrent(PG_FUNCTION_ARGS)
 {
-   Datum arg0 = PG_GETARG_DATUM(0);
-   Oid id = GetCurrentDict();
+   Datum       arg0 = PG_GETARG_DATUM(0);
+   Oid         id = GetCurrentDict();
 
    return DirectFunctionCall2(ts_lexize,
                               ObjectIdGetDatum(id),
@@ -174,7 +174,7 @@ tsa_lexize_bycurrent(PG_FUNCTION_ARGS)
 Datum
 tsa_set_curdict(PG_FUNCTION_ARGS)
 {
-   Oid dict_oid = PG_GETARG_OID(0);
+   Oid         dict_oid = PG_GETARG_OID(0);
 
    if (!SearchSysCacheExists(TSDICTOID,
                              ObjectIdGetDatum(dict_oid),
@@ -191,8 +191,8 @@ tsa_set_curdict(PG_FUNCTION_ARGS)
 Datum
 tsa_set_curdict_byname(PG_FUNCTION_ARGS)
 {
-   text *name = PG_GETARG_TEXT_P(0);
-   Oid dict_oid;
+   text       *name = PG_GETARG_TEXT_P(0);
+   Oid         dict_oid;
 
    dict_oid = TSDictionaryGetDictid(stringToQualifiedNameList(TextPGetCString(name)), false);
 
@@ -213,7 +213,7 @@ tsa_token_type_current(PG_FUNCTION_ARGS)
 Datum
 tsa_set_curprs(PG_FUNCTION_ARGS)
 {
-   Oid parser_oid = PG_GETARG_OID(0);
+   Oid         parser_oid = PG_GETARG_OID(0);
 
    if (!SearchSysCacheExists(TSPARSEROID,
                              ObjectIdGetDatum(parser_oid),
@@ -230,8 +230,8 @@ tsa_set_curprs(PG_FUNCTION_ARGS)
 Datum
 tsa_set_curprs_byname(PG_FUNCTION_ARGS)
 {
-   text *name = PG_GETARG_TEXT_P(0);
-   Oid parser_oid;
+   text       *name = PG_GETARG_TEXT_P(0);
+   Oid         parser_oid;
 
    parser_oid = TSParserGetPrsid(stringToQualifiedNameList(TextPGetCString(name)), false);
 
@@ -252,12 +252,12 @@ tsa_parse_current(PG_FUNCTION_ARGS)
 Datum
 tsa_set_curcfg(PG_FUNCTION_ARGS)
 {
-   Oid arg0 = PG_GETARG_OID(0);
-   char *name;
+   Oid         arg0 = PG_GETARG_OID(0);
+   char       *name;
 
    name = DatumGetCString(DirectFunctionCall1(regconfigout,
                                               ObjectIdGetDatum(arg0)));
-               
+
    set_config_option("default_text_search_config", name,
                      PGC_USERSET,
                      PGC_S_SESSION,
@@ -271,8 +271,8 @@ tsa_set_curcfg(PG_FUNCTION_ARGS)
 Datum
 tsa_set_curcfg_byname(PG_FUNCTION_ARGS)
 {
-   text *arg0 = PG_GETARG_TEXT_P(0);
-   char *name;
+   text       *arg0 = PG_GETARG_TEXT_P(0);
+   char       *name;
 
    name = TextPGetCString(arg0);
 
@@ -289,9 +289,9 @@ tsa_set_curcfg_byname(PG_FUNCTION_ARGS)
 Datum
 tsa_to_tsvector_name(PG_FUNCTION_ARGS)
 {
-   text *cfgname = PG_GETARG_TEXT_P(0);
-   Datum arg1 = PG_GETARG_DATUM(1);
-   Oid config_oid;
+   text       *cfgname = PG_GETARG_TEXT_P(0);
+   Datum       arg1 = PG_GETARG_DATUM(1);
+   Oid         config_oid;
 
    config_oid = TextGetObjectId(regconfigin, cfgname);
 
@@ -303,9 +303,9 @@ tsa_to_tsvector_name(PG_FUNCTION_ARGS)
 Datum
 tsa_to_tsquery_name(PG_FUNCTION_ARGS)
 {
-   text *cfgname = PG_GETARG_TEXT_P(0);
-   Datum arg1 = PG_GETARG_DATUM(1);
-   Oid config_oid;
+   text       *cfgname = PG_GETARG_TEXT_P(0);
+   Datum       arg1 = PG_GETARG_DATUM(1);
+   Oid         config_oid;
 
    config_oid = TextGetObjectId(regconfigin, cfgname);
 
@@ -318,9 +318,9 @@ tsa_to_tsquery_name(PG_FUNCTION_ARGS)
 Datum
 tsa_plainto_tsquery_name(PG_FUNCTION_ARGS)
 {
-   text *cfgname = PG_GETARG_TEXT_P(0);
-   Datum arg1 = PG_GETARG_DATUM(1);
-   Oid config_oid;
+   text       *cfgname = PG_GETARG_TEXT_P(0);
+   Datum       arg1 = PG_GETARG_DATUM(1);
+   Oid         config_oid;
 
    config_oid = TextGetObjectId(regconfigin, cfgname);
 
@@ -332,22 +332,22 @@ tsa_plainto_tsquery_name(PG_FUNCTION_ARGS)
 Datum
 tsa_headline_byname(PG_FUNCTION_ARGS)
 {
-   Datum arg0 = PG_GETARG_DATUM(0);
-   Datum arg1 = PG_GETARG_DATUM(1);
-   Datum arg2 = PG_GETARG_DATUM(2);
-   Datum result;
-   Oid config_oid;
+   Datum       arg0 = PG_GETARG_DATUM(0);
+   Datum       arg1 = PG_GETARG_DATUM(1);
+   Datum       arg2 = PG_GETARG_DATUM(2);
+   Datum       result;
+   Oid         config_oid;
 
    /* first parameter has to be converted to oid */
    config_oid = DatumGetObjectId(DirectFunctionCall1(regconfigin,
-                                                     DirectFunctionCall1(textout, arg0)));
+                                       DirectFunctionCall1(textout, arg0)));
 
    if (PG_NARGS() == 3)
        result = DirectFunctionCall3(ts_headline_byid,
-                                    ObjectIdGetDatum(config_oid), arg1, arg2);
+                                  ObjectIdGetDatum(config_oid), arg1, arg2);
    else
    {
-       Datum arg3 = PG_GETARG_DATUM(3);
+       Datum       arg3 = PG_GETARG_DATUM(3);
 
        result = DirectFunctionCall4(ts_headline_byid_opt,
                                     ObjectIdGetDatum(config_oid),
@@ -371,11 +371,11 @@ tsa_tsearch2(PG_FUNCTION_ARGS)
 {
    TriggerData *trigdata;
    Trigger    *trigger;
-   char **tgargs;
+   char      **tgargs;
    int         i;
 
    /* Check call context */
-   if (!CALLED_AS_TRIGGER(fcinfo)) /* internal error */
+   if (!CALLED_AS_TRIGGER(fcinfo))     /* internal error */
        elog(ERROR, "tsvector_update_trigger: not fired by trigger manager");
 
    trigdata = (TriggerData *) fcinfo->context;
@@ -388,7 +388,7 @@ tsa_tsearch2(PG_FUNCTION_ARGS)
    tgargs = (char **) palloc((trigger->tgnargs + 1) * sizeof(char *));
    tgargs[0] = trigger->tgargs[0];
    for (i = 1; i < trigger->tgnargs; i++)
-       tgargs[i+1] = trigger->tgargs[i];
+       tgargs[i + 1] = trigger->tgargs[i];
 
    tgargs[1] = pstrdup(GetConfigOptionByName("default_text_search_config",
                                              NULL));
index d711f47207e2db510cb68ff2c645deb7187e61a3..e1aa8af0943b1c8d8e94af356a4958cc386046c8 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Copyright (c) 2007 PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/contrib/uuid-ossp/uuid-ossp.c,v 1.3 2007/10/23 21:38:16 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/uuid-ossp/uuid-ossp.c,v 1.4 2007/11/15 21:14:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 PG_MODULE_MAGIC;
 
 
-Datum uuid_nil(PG_FUNCTION_ARGS);
-Datum uuid_ns_dns(PG_FUNCTION_ARGS);
-Datum uuid_ns_url(PG_FUNCTION_ARGS);
-Datum uuid_ns_oid(PG_FUNCTION_ARGS);
-Datum uuid_ns_x500(PG_FUNCTION_ARGS);
+Datum      uuid_nil(PG_FUNCTION_ARGS);
+Datum      uuid_ns_dns(PG_FUNCTION_ARGS);
+Datum      uuid_ns_url(PG_FUNCTION_ARGS);
+Datum      uuid_ns_oid(PG_FUNCTION_ARGS);
+Datum      uuid_ns_x500(PG_FUNCTION_ARGS);
 
-Datum uuid_generate_v1(PG_FUNCTION_ARGS);
-Datum uuid_generate_v1mc(PG_FUNCTION_ARGS);
-Datum uuid_generate_v3(PG_FUNCTION_ARGS);
-Datum uuid_generate_v4(PG_FUNCTION_ARGS);
-Datum uuid_generate_v5(PG_FUNCTION_ARGS);
+Datum      uuid_generate_v1(PG_FUNCTION_ARGS);
+Datum      uuid_generate_v1mc(PG_FUNCTION_ARGS);
+Datum      uuid_generate_v3(PG_FUNCTION_ARGS);
+Datum      uuid_generate_v4(PG_FUNCTION_ARGS);
+Datum      uuid_generate_v5(PG_FUNCTION_ARGS);
 
 
 PG_FUNCTION_INFO_V1(uuid_nil);
@@ -66,11 +66,11 @@ PG_FUNCTION_INFO_V1(uuid_generate_v5);
 
 
 static char *
-uuid_to_string(const uuid_t *uuid)
+uuid_to_string(const uuid_t * uuid)
 {
-   char   *buf = palloc(UUID_LEN_STR + 1);
-   void   *ptr = buf;
-   size_t  len = UUID_LEN_STR + 1;
+   char       *buf = palloc(UUID_LEN_STR + 1);
+   void       *ptr = buf;
+   size_t      len = UUID_LEN_STR + 1;
 
    uuid_export(uuid, UUID_FMT_STR, &ptr, &len);
 
@@ -79,7 +79,7 @@ uuid_to_string(const uuid_t *uuid)
 
 
 static void
-string_to_uuid(const char *str, uuid_t *uuid)
+string_to_uuid(const char *str, uuid_t * uuid)
 {
    uuid_import(uuid, UUID_FMT_STR, str, UUID_LEN_STR + 1);
 }
@@ -88,8 +88,8 @@ string_to_uuid(const char *str, uuid_t *uuid)
 static Datum
 special_uuid_value(const char *name)
 {
-   uuid_t *uuid;
-   char   *str;
+   uuid_t     *uuid;
+   char       *str;
 
    uuid_create(&uuid);
    uuid_load(uuid, name);
@@ -136,10 +136,10 @@ uuid_ns_x500(PG_FUNCTION_ARGS)
 
 
 static Datum
-uuid_generate_internal(int mode, const uuid_t *ns, const char *name)
+uuid_generate_internal(int mode, const uuid_t * ns, const char *name)
 {
-   uuid_t *uuid;
-   char   *str;
+   uuid_t     *uuid;
+   char       *str;
 
    uuid_create(&uuid);
    uuid_make(uuid, mode, ns, name);
@@ -165,7 +165,7 @@ uuid_generate_v1mc(PG_FUNCTION_ARGS)
 
 
 static Datum
-uuid_generate_v35_internal(int mode, pg_uuid_t *ns, text *name)
+uuid_generate_v35_internal(int mode, pg_uuid_t * ns, text *name)
 {
    uuid_t     *ns_uuid;
    Datum       result;
@@ -176,7 +176,7 @@ uuid_generate_v35_internal(int mode, pg_uuid_t *ns, text *name)
 
    result = uuid_generate_internal(mode,
                                    ns_uuid,
-                                   DatumGetCString(DirectFunctionCall1(textout, PointerGetDatum(name))));
+      DatumGetCString(DirectFunctionCall1(textout, PointerGetDatum(name))));
 
    uuid_destroy(ns_uuid);
 
index a6dab8da121cb9800a87ed613c18892859bd0faa..eb8b136cbd9fc174f442e39cb6020018064adb13 100644 (file)
@@ -28,7 +28,7 @@
  * without explicitly invoking the toaster.
  *
  * This change will break any code that assumes it needn't detoast values
- * that have been put into a tuple but never sent to disk.  Hopefully there
+ * that have been put into a tuple but never sent to disk. Hopefully there
  * are few such places.
  *
  * Varlenas still have alignment 'i' (or 'd') in pg_type/pg_attribute, since
@@ -57,7 +57,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.118 2007/11/07 12:24:23 petere Exp $
+ *   $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.119 2007/11/15 21:14:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -99,19 +99,19 @@ heap_compute_data_size(TupleDesc tupleDesc,
 
    for (i = 0; i < numberOfAttributes; i++)
    {
-       Datum   val;
+       Datum       val;
 
        if (isnull[i])
            continue;
 
        val = values[i];
 
-       if (ATT_IS_PACKABLE(att[i]) &&
+       if (ATT_IS_PACKABLE(att[i]) &&
            VARATT_CAN_MAKE_SHORT(DatumGetPointer(val)))
        {
            /*
-            * we're anticipating converting to a short varlena header,
-            * so adjust length and don't count any alignment
+            * we're anticipating converting to a short varlena header, so
+            * adjust length and don't count any alignment
             */
            data_length += VARATT_CONVERTED_SHORT_SIZE(DatumGetPointer(val));
        }
@@ -147,19 +147,19 @@ ComputeDataSize(TupleDesc tupleDesc,
 
    for (i = 0; i < numberOfAttributes; i++)
    {
-       Datum   val;
+       Datum       val;
 
        if (nulls[i] != ' ')
            continue;
 
        val = values[i];
 
-       if (ATT_IS_PACKABLE(att[i]) &&
+       if (ATT_IS_PACKABLE(att[i]) &&
            VARATT_CAN_MAKE_SHORT(DatumGetPointer(val)))
        {
            /*
-            * we're anticipating converting to a short varlena header,
-            * so adjust length and don't count any alignment
+            * we're anticipating converting to a short varlena header, so
+            * adjust length and don't count any alignment
             */
            data_length += VARATT_CONVERTED_SHORT_SIZE(DatumGetPointer(val));
        }
@@ -195,6 +195,7 @@ heap_fill_tuple(TupleDesc tupleDesc,
    int         i;
    int         numberOfAttributes = tupleDesc->natts;
    Form_pg_attribute *att = tupleDesc->attrs;
+
 #ifdef USE_ASSERT_CHECKING
    char       *start = data;
 #endif
@@ -238,8 +239,8 @@ heap_fill_tuple(TupleDesc tupleDesc,
        }
 
        /*
-        * XXX we use the att_align macros on the pointer value itself,
-        * not on an offset.  This is a bit of a hack.
+        * XXX we use the att_align macros on the pointer value itself, not on
+        * an offset.  This is a bit of a hack.
         */
 
        if (att[i]->attbyval)
@@ -327,6 +328,7 @@ DataFill(TupleDesc tupleDesc,
    int         i;
    int         numberOfAttributes = tupleDesc->natts;
    Form_pg_attribute *att = tupleDesc->attrs;
+
 #ifdef USE_ASSERT_CHECKING
    char       *start = data;
 #endif
@@ -370,8 +372,8 @@ DataFill(TupleDesc tupleDesc,
        }
 
        /*
-        * XXX we use the att_align macros on the pointer value itself,
-        * not on an offset.  This is a bit of a hack.
+        * XXX we use the att_align macros on the pointer value itself, not on
+        * an offset.  This is a bit of a hack.
         */
 
        if (att[i]->attbyval)
@@ -611,8 +613,8 @@ nocachegetattr(HeapTuple tuple,
 
        /*
         * Otherwise, check for non-fixed-length attrs up to and including
-        * target.  If there aren't any, it's safe to cheaply initialize
-        * the cached offsets for these attrs.
+        * target.  If there aren't any, it's safe to cheaply initialize the
+        * cached offsets for these attrs.
         */
        if (HeapTupleHasVarWidth(tuple))
        {
@@ -673,8 +675,8 @@ nocachegetattr(HeapTuple tuple,
        int         i;
 
        /*
-        * Now we know that we have to walk the tuple CAREFULLY.  But we
-        * still might be able to cache some offsets for next time.
+        * Now we know that we have to walk the tuple CAREFULLY.  But we still
+        * might be able to cache some offsets for next time.
         *
         * Note - This loop is a little tricky.  For each non-null attribute,
         * we have to first account for alignment padding before the attr,
@@ -683,12 +685,12 @@ nocachegetattr(HeapTuple tuple,
         * attcacheoff until we reach either a null or a var-width attribute.
         */
        off = 0;
-       for (i = 0; ; i++)          /* loop exit is at "break" */
+       for (i = 0;; i++)       /* loop exit is at "break" */
        {
            if (HeapTupleHasNulls(tuple) && att_isnull(i, bp))
            {
                usecache = false;
-               continue;           /* this cannot be the target att */
+               continue;       /* this cannot be the target att */
            }
 
            /* If we know the next offset, we can skip the rest */
@@ -697,10 +699,10 @@ nocachegetattr(HeapTuple tuple,
            else if (att[i]->attlen == -1)
            {
                /*
-                * We can only cache the offset for a varlena attribute
-                * if the offset is already suitably aligned, so that there
-                * would be no pad bytes in any case: then the offset will
-                * be valid for either an aligned or unaligned value.
+                * We can only cache the offset for a varlena attribute if the
+                * offset is already suitably aligned, so that there would be
+                * no pad bytes in any case: then the offset will be valid for
+                * either an aligned or unaligned value.
                 */
                if (usecache &&
                    off == att_align_nominal(off, att[i]->attalign))
@@ -771,11 +773,12 @@ heap_getsysattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
            break;
        case MinCommandIdAttributeNumber:
        case MaxCommandIdAttributeNumber:
+
            /*
-            * cmin and cmax are now both aliases for the same field,
-            * which can in fact also be a combo command id.  XXX perhaps we
-            * should return the "real" cmin or cmax if possible, that is
-            * if we are inside the originating transaction?
+            * cmin and cmax are now both aliases for the same field, which
+            * can in fact also be a combo command id.  XXX perhaps we should
+            * return the "real" cmin or cmax if possible, that is if we are
+            * inside the originating transaction?
             */
            result = CommandIdGetDatum(HeapTupleHeaderGetRawCommandId(tup->t_data));
            break;
@@ -855,7 +858,8 @@ heap_form_tuple(TupleDesc tupleDescriptor,
 {
    HeapTuple   tuple;          /* return tuple */
    HeapTupleHeader td;         /* tuple data */
-   Size        len, data_len;
+   Size        len,
+               data_len;
    int         hoff;
    bool        hasnull = false;
    Form_pg_attribute *att = tupleDescriptor->attrs;
@@ -965,7 +969,8 @@ heap_formtuple(TupleDesc tupleDescriptor,
 {
    HeapTuple   tuple;          /* return tuple */
    HeapTupleHeader td;         /* tuple data */
-   Size        len, data_len;
+   Size        len,
+               data_len;
    int         hoff;
    bool        hasnull = false;
    Form_pg_attribute *att = tupleDescriptor->attrs;
@@ -1263,10 +1268,10 @@ heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
        else if (thisatt->attlen == -1)
        {
            /*
-            * We can only cache the offset for a varlena attribute
-            * if the offset is already suitably aligned, so that there
-            * would be no pad bytes in any case: then the offset will
-            * be valid for either an aligned or unaligned value.
+            * We can only cache the offset for a varlena attribute if the
+            * offset is already suitably aligned, so that there would be no
+            * pad bytes in any case: then the offset will be valid for either
+            * an aligned or unaligned value.
             */
            if (!slow &&
                off == att_align_nominal(off, thisatt->attalign))
@@ -1375,10 +1380,10 @@ heap_deformtuple(HeapTuple tuple,
        else if (thisatt->attlen == -1)
        {
            /*
-            * We can only cache the offset for a varlena attribute
-            * if the offset is already suitably aligned, so that there
-            * would be no pad bytes in any case: then the offset will
-            * be valid for either an aligned or unaligned value.
+            * We can only cache the offset for a varlena attribute if the
+            * offset is already suitably aligned, so that there would be no
+            * pad bytes in any case: then the offset will be valid for either
+            * an aligned or unaligned value.
             */
            if (!slow &&
                off == att_align_nominal(off, thisatt->attalign))
@@ -1484,10 +1489,10 @@ slot_deform_tuple(TupleTableSlot *slot, int natts)
        else if (thisatt->attlen == -1)
        {
            /*
-            * We can only cache the offset for a varlena attribute
-            * if the offset is already suitably aligned, so that there
-            * would be no pad bytes in any case: then the offset will
-            * be valid for either an aligned or unaligned value.
+            * We can only cache the offset for a varlena attribute if the
+            * offset is already suitably aligned, so that there would be no
+            * pad bytes in any case: then the offset will be valid for either
+            * an aligned or unaligned value.
             */
            if (!slow &&
                off == att_align_nominal(off, thisatt->attalign))
@@ -1791,7 +1796,8 @@ heap_form_minimal_tuple(TupleDesc tupleDescriptor,
                        bool *isnull)
 {
    MinimalTuple tuple;         /* return tuple */
-   Size        len, data_len;
+   Size        len,
+               data_len;
    int         hoff;
    bool        hasnull = false;
    Form_pg_attribute *att = tupleDescriptor->attrs;
index 5412ca0cf3db45d8b7a8e8fcb45d465dc19e98a3..892363b3a99805bc05089cd20bd688a6e2092ba5 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/access/common/indextuple.c,v 1.83 2007/11/07 12:24:24 petere Exp $
+ *   $PostgreSQL: pgsql/src/backend/access/common/indextuple.c,v 1.84 2007/11/15 21:14:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -77,7 +77,7 @@ index_form_tuple(TupleDesc tupleDescriptor,
        {
            untoasted_values[i] =
                PointerGetDatum(heap_tuple_fetch_attr((struct varlena *)
-                                                     DatumGetPointer(values[i])));
+                                               DatumGetPointer(values[i])));
            untoasted_free[i] = true;
        }
 
@@ -309,8 +309,8 @@ nocache_index_getattr(IndexTuple tup,
 
        /*
         * Otherwise, check for non-fixed-length attrs up to and including
-        * target.  If there aren't any, it's safe to cheaply initialize
-        * the cached offsets for these attrs.
+        * target.  If there aren't any, it's safe to cheaply initialize the
+        * cached offsets for these attrs.
         */
        if (IndexTupleHasVarwidths(tup))
        {
@@ -371,8 +371,8 @@ nocache_index_getattr(IndexTuple tup,
        int         i;
 
        /*
-        * Now we know that we have to walk the tuple CAREFULLY.  But we
-        * still might be able to cache some offsets for next time.
+        * Now we know that we have to walk the tuple CAREFULLY.  But we still
+        * might be able to cache some offsets for next time.
         *
         * Note - This loop is a little tricky.  For each non-null attribute,
         * we have to first account for alignment padding before the attr,
@@ -381,12 +381,12 @@ nocache_index_getattr(IndexTuple tup,
         * attcacheoff until we reach either a null or a var-width attribute.
         */
        off = 0;
-       for (i = 0; ; i++)          /* loop exit is at "break" */
+       for (i = 0;; i++)       /* loop exit is at "break" */
        {
            if (IndexTupleHasNulls(tup) && att_isnull(i, bp))
            {
                usecache = false;
-               continue;           /* this cannot be the target att */
+               continue;       /* this cannot be the target att */
            }
 
            /* If we know the next offset, we can skip the rest */
@@ -395,10 +395,10 @@ nocache_index_getattr(IndexTuple tup,
            else if (att[i]->attlen == -1)
            {
                /*
-                * We can only cache the offset for a varlena attribute
-                * if the offset is already suitably aligned, so that there
-                * would be no pad bytes in any case: then the offset will
-                * be valid for either an aligned or unaligned value.
+                * We can only cache the offset for a varlena attribute if the
+                * offset is already suitably aligned, so that there would be
+                * no pad bytes in any case: then the offset will be valid for
+                * either an aligned or unaligned value.
                 */
                if (usecache &&
                    off == att_align_nominal(off, att[i]->attalign))
index 9f40fc59d3fd2b56e8cd6cda59a5a4db467607c9..7e4afd70bd520d797067c948d386b4bab0a92b96 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/access/common/reloptions.c,v 1.5 2007/06/03 22:16:02 petere Exp $
+ *   $PostgreSQL: pgsql/src/backend/access/common/reloptions.c,v 1.6 2007/11/15 21:14:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -206,8 +206,8 @@ parseRelOptions(Datum options, int numkeywords, const char *const * keywords,
                if (values[j] && validate)
                    ereport(ERROR,
                            (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                            errmsg("parameter \"%s\" specified more than once",
-                                   keywords[j])));
+                         errmsg("parameter \"%s\" specified more than once",
+                                keywords[j])));
                value_len = text_len - kw_len - 1;
                value = (char *) palloc(value_len + 1);
                memcpy(value, text_str + kw_len + 1, value_len);
index d608bedb6058a4a903147cbb0418696660661f67..430b72a92b24cdcc8177b8bfb8340daa1c771694 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/access/gin/ginarrayproc.c,v 1.10 2007/08/21 01:11:12 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/access/gin/ginarrayproc.c,v 1.11 2007/11/15 21:14:31 momjian Exp $
  *-------------------------------------------------------------------------
  */
 #include "postgres.h"
@@ -60,17 +60,18 @@ ginarrayextract(PG_FUNCTION_ARGS)
                      elmlen, elmbyval, elmalign,
                      &entries, NULL, (int *) nentries);
 
-   if ( *nentries == 0 && PG_NARGS() == 3 )
+   if (*nentries == 0 && PG_NARGS() == 3)
    {
-       switch( PG_GETARG_UINT16(2) ) /* StrategyNumber */
+       switch (PG_GETARG_UINT16(2))    /* StrategyNumber */
        {
            case GinOverlapStrategy:
-                   *nentries = -1; /* nobody can be found */
-                   break;
+               *nentries = -1; /* nobody can be found */
+               break;
            case GinContainsStrategy:
            case GinContainedStrategy:
            case GinEqualStrategy:
-           default:    /* require fullscan: GIN can't find void arrays */
+           default:            /* require fullscan: GIN can't find void
+                                * arrays */
                break;
        }
    }
index 1a711e93c645688abbe192420da29f47c28b4e5e..a89c384dfc30eea1ba17cbb3e3e4df43aadee380 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *         $PostgreSQL: pgsql/src/backend/access/gin/ginbtree.c,v 1.9 2007/06/05 12:47:49 teodor Exp $
+ *         $PostgreSQL: pgsql/src/backend/access/gin/ginbtree.c,v 1.10 2007/11/15 21:14:31 momjian Exp $
  *-------------------------------------------------------------------------
  */
 
@@ -317,8 +317,8 @@ ginInsertValue(GinBtree btree, GinBtreeStack *stack)
            Page        newlpage;
 
            /*
-            * newlpage is a pointer to memory page, it doesn't associate
-            * with buffer, stack->buffer should be untouched
+            * newlpage is a pointer to memory page, it doesn't associate with
+            * buffer, stack->buffer should be untouched
             */
            newlpage = btree->splitPage(btree, stack->buffer, rbuffer, stack->off, &rdata);
 
index d9242c667a6137b2741a7d6b9b8fe3d334ba7232..eb6ccfc0b40e867db8fcc66a908b11b95a3c6adc 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *         $PostgreSQL: pgsql/src/backend/access/gin/gindatapage.c,v 1.7 2007/06/04 15:56:28 teodor Exp $
+ *         $PostgreSQL: pgsql/src/backend/access/gin/gindatapage.c,v 1.8 2007/11/15 21:14:31 momjian Exp $
  *-------------------------------------------------------------------------
  */
 
@@ -358,7 +358,7 @@ dataPlaceToPage(GinBtree btree, Buffer buf, OffsetNumber off, XLogRecData **prda
    static XLogRecData rdata[3];
    int         sizeofitem = GinSizeOfItem(page);
    static ginxlogInsert data;
-   int         cnt=0;
+   int         cnt = 0;
 
    *prdata = rdata;
    Assert(GinPageIsData(page));
@@ -373,14 +373,14 @@ dataPlaceToPage(GinBtree btree, Buffer buf, OffsetNumber off, XLogRecData **prda
    data.isData = TRUE;
    data.isLeaf = GinPageIsLeaf(page) ? TRUE : FALSE;
 
-   /* 
-    * Prevent full page write if child's split occurs. That is needed
-    * to remove incomplete splits while replaying WAL
-    * 
-    * data.updateBlkno contains new block number (of newly created right page)
-    * for recently splited page.
+   /*
+    * Prevent full page write if child's split occurs. That is needed to
+    * remove incomplete splits while replaying WAL
+    *
+    * data.updateBlkno contains new block number (of newly created right
+    * page) for recently splited page.
     */
-   if ( data.updateBlkno == InvalidBlockNumber ) 
+   if (data.updateBlkno == InvalidBlockNumber)
    {
        rdata[0].buffer = buf;
        rdata[0].buffer_std = FALSE;
@@ -393,7 +393,7 @@ dataPlaceToPage(GinBtree btree, Buffer buf, OffsetNumber off, XLogRecData **prda
    rdata[cnt].buffer = InvalidBuffer;
    rdata[cnt].data = (char *) &data;
    rdata[cnt].len = sizeof(ginxlogInsert);
-   rdata[cnt].next = &rdata[cnt+1];
+   rdata[cnt].next = &rdata[cnt + 1];
    cnt++;
 
    rdata[cnt].buffer = InvalidBuffer;
index 2c335aea0cd7553d261d85a888a9254bfea6f7b9..134c5f99dd068c1e6c7740a9d2019c8ad4e33fba 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *         $PostgreSQL: pgsql/src/backend/access/gin/ginentrypage.c,v 1.10 2007/10/29 13:49:21 teodor Exp $
+ *         $PostgreSQL: pgsql/src/backend/access/gin/ginentrypage.c,v 1.11 2007/11/15 21:14:31 momjian Exp $
  *-------------------------------------------------------------------------
  */
 
@@ -354,7 +354,7 @@ entryPlaceToPage(GinBtree btree, Buffer buf, OffsetNumber off, XLogRecData **prd
    static XLogRecData rdata[3];
    OffsetNumber placed;
    static ginxlogInsert data;
-   int     cnt=0;
+   int         cnt = 0;
 
    *prdata = rdata;
    data.updateBlkno = entryPreparePage(btree, page, off);
@@ -372,14 +372,14 @@ entryPlaceToPage(GinBtree btree, Buffer buf, OffsetNumber off, XLogRecData **prd
    data.isData = false;
    data.isLeaf = GinPageIsLeaf(page) ? TRUE : FALSE;
 
-    /*
-    * Prevent full page write if child's split occurs. That is needed
-    * to remove incomplete splits while replaying WAL
+   /*
+    * Prevent full page write if child's split occurs. That is needed to
+    * remove incomplete splits while replaying WAL
     *
-    * data.updateBlkno contains new block number (of newly created right page)
-    * for recently splited page.
+    * data.updateBlkno contains new block number (of newly created right
+    * page) for recently splited page.
     */
-   if ( data.updateBlkno == InvalidBlockNumber ) 
+   if (data.updateBlkno == InvalidBlockNumber)
    {
        rdata[0].buffer = buf;
        rdata[0].buffer_std = TRUE;
@@ -392,7 +392,7 @@ entryPlaceToPage(GinBtree btree, Buffer buf, OffsetNumber off, XLogRecData **prd
    rdata[cnt].buffer = InvalidBuffer;
    rdata[cnt].data = (char *) &data;
    rdata[cnt].len = sizeof(ginxlogInsert);
-   rdata[cnt].next = &rdata[cnt+1];
+   rdata[cnt].next = &rdata[cnt + 1];
    cnt++;
 
    rdata[cnt].buffer = InvalidBuffer;
index 66949f964c8ccead2f3f2ef084df30037e9feb96..b964f036a086108c5933e0d7e5f01ff2abee96a6 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *         $PostgreSQL: pgsql/src/backend/access/gin/ginget.c,v 1.8 2007/06/04 15:56:28 teodor Exp $
+ *         $PostgreSQL: pgsql/src/backend/access/gin/ginget.c,v 1.9 2007/11/15 21:14:31 momjian Exp $
  *-------------------------------------------------------------------------
  */
 
@@ -23,29 +23,29 @@ findItemInPage(Page page, ItemPointer item, OffsetNumber *off)
    OffsetNumber maxoff = GinPageGetOpaque(page)->maxoff;
    int         res;
 
-   if ( GinPageGetOpaque(page)->flags & GIN_DELETED )
+   if (GinPageGetOpaque(page)->flags & GIN_DELETED)
        /* page was deleted by concurrent  vacuum */
        return false;
 
-   if ( *off > maxoff || *off == InvalidOffsetNumber )
+   if (*off > maxoff || *off == InvalidOffsetNumber)
        res = -1;
    else
        res = compareItemPointers(item, (ItemPointer) GinDataPageGetItem(page, *off));
 
-   if ( res == 0 ) 
+   if (res == 0)
    {
        /* page isn't changed */
-       return true; 
-   } 
-   else if ( res > 0 ) 
+       return true;
+   }
+   else if (res > 0)
    {
-       /* 
-        * some items was added before our position, look further to find 
-        * it or first greater 
+       /*
+        * some items was added before our position, look further to find it
+        * or first greater
         */
-   
+
        (*off)++;
-       for (; *off <= maxoff; (*off)++) 
+       for (; *off <= maxoff; (*off)++)
        {
            res = compareItemPointers(item, (ItemPointer) GinDataPageGetItem(page, *off));
 
@@ -53,7 +53,7 @@ findItemInPage(Page page, ItemPointer item, OffsetNumber *off)
                return true;
 
            if (res < 0)
-           {   
+           {
                (*off)--;
                return true;
            }
@@ -61,20 +61,20 @@ findItemInPage(Page page, ItemPointer item, OffsetNumber *off)
    }
    else
    {
-       /* 
-        * some items was deleted before our position, look from begining
-        * to find it or first greater
+       /*
+        * some items was deleted before our position, look from begining to
+        * find it or first greater
         */
 
-       for(*off = FirstOffsetNumber; *off<= maxoff; (*off)++) 
+       for (*off = FirstOffsetNumber; *off <= maxoff; (*off)++)
        {
            res = compareItemPointers(item, (ItemPointer) GinDataPageGetItem(page, *off));
 
-           if ( res == 0 )
+           if (res == 0)
                return true;
 
            if (res < 0)
-           {   
+           {
                (*off)--;
                return true;
            }
@@ -174,7 +174,7 @@ startScanEntry(Relation index, GinState *ginstate, GinScanEntry entry, bool firs
        page = BufferGetPage(entry->buffer);
 
        /* try to find curItem in current buffer */
-       if ( findItemInPage(page, &entry->curItem, &entry->offset) )
+       if (findItemInPage(page, &entry->curItem, &entry->offset))
            return;
 
        /* walk to right */
@@ -186,13 +186,13 @@ startScanEntry(Relation index, GinState *ginstate, GinScanEntry entry, bool firs
            page = BufferGetPage(entry->buffer);
 
            entry->offset = InvalidOffsetNumber;
-           if ( findItemInPage(page, &entry->curItem, &entry->offset) )
+           if (findItemInPage(page, &entry->curItem, &entry->offset))
                return;
        }
 
        /*
-        * curItem and any greated items was deleted by concurrent vacuum,
-        * so we finished scan with currrent entry
+        * curItem and any greated items was deleted by concurrent vacuum, so
+        * we finished scan with currrent entry
         */
    }
 }
@@ -221,10 +221,10 @@ startScanKey(Relation index, GinState *ginstate, GinScanKey key)
        if (GinFuzzySearchLimit > 0)
        {
            /*
-            * If all of keys more than threshold we will try to reduce result,
-            * we hope (and only hope, for intersection operation of array our
-            * supposition isn't true), that total result will not more than
-            * minimal predictNumberResult.
+            * If all of keys more than threshold we will try to reduce
+            * result, we hope (and only hope, for intersection operation of
+            * array our supposition isn't true), that total result will not
+            * more than minimal predictNumberResult.
             */
 
            for (i = 0; i < key->nentries; i++)
index 2eb1ba95b4bd4296ab53daaaaa1e28ad2e6b4986..2e40f8b8d8c3e52a24287e5cd57138c50c04f6f4 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *         $PostgreSQL: pgsql/src/backend/access/gin/ginscan.c,v 1.10 2007/05/27 03:50:38 tgl Exp $
+ *         $PostgreSQL: pgsql/src/backend/access/gin/ginscan.c,v 1.11 2007/11/15 21:14:31 momjian Exp $
  *-------------------------------------------------------------------------
  */
 
@@ -164,13 +164,13 @@ newScanKey(IndexScanDesc scan)
                                       UInt16GetDatum(scankey[i].sk_strategy)
                                                              )
            );
-       if ( nEntryValues < 0 )
+       if (nEntryValues < 0)
        {
            /*
-            * extractQueryFn signals that nothing will be found,
-            * so we can just set isVoidRes flag...
+            * extractQueryFn signals that nothing will be found, so we can
+            * just set isVoidRes flag...
             */
-           so->isVoidRes = true;   
+           so->isVoidRes = true;
            break;
        }
        if (entryValues == NULL || nEntryValues == 0)
@@ -187,7 +187,7 @@ newScanKey(IndexScanDesc scan)
    if (so->nkeys == 0 && !so->isVoidRes)
        ereport(ERROR,
                (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
-                errmsg("GIN index does not support search with void query")));
+              errmsg("GIN index does not support search with void query")));
 
    pgstat_count_index_scan(scan->indexRelation);
 }
index e704e8051ebc4367b4bec99aef910e239056fa47..488a58beb5e3d8beb5ed4d634a005315470efdc5 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *         $PostgreSQL: pgsql/src/backend/access/gin/ginutil.c,v 1.10 2007/01/31 15:09:45 teodor Exp $
+ *         $PostgreSQL: pgsql/src/backend/access/gin/ginutil.c,v 1.11 2007/11/15 21:14:31 momjian Exp $
  *-------------------------------------------------------------------------
  */
 
@@ -126,17 +126,17 @@ compareEntries(GinState *ginstate, Datum a, Datum b)
                                       &ginstate->compareFn,
                                       a, b
                                       )
-   );
+       );
 }
 
 typedef struct
 {
    FmgrInfo   *cmpDatumFunc;
    bool       *needUnique;
-} cmpEntriesData;
+}  cmpEntriesData;
 
 static int
-cmpEntries(const Datum *a, const Datum *b, cmpEntriesData *arg)
+cmpEntries(const Datum *a, const Datum *b, cmpEntriesData * arg)
 {
    int         res = DatumGetInt32(FunctionCall2(arg->cmpDatumFunc,
                                                  *a, *b));
index 1f26869d646ea886849b3a77d5a6b9c1994c7890..9c0482a8903b6901cb31ffabceef60b31a08cf97 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *         $PostgreSQL: pgsql/src/backend/access/gin/ginvacuum.c,v 1.17 2007/09/20 17:56:30 tgl Exp $
+ *         $PostgreSQL: pgsql/src/backend/access/gin/ginvacuum.c,v 1.18 2007/11/15 21:14:31 momjian Exp $
  *-------------------------------------------------------------------------
  */
 
@@ -28,7 +28,7 @@ typedef struct
    IndexBulkDeleteCallback callback;
    void       *callback_state;
    GinState    ginstate;
-   BufferAccessStrategy    strategy;
+   BufferAccessStrategy strategy;
 } GinVacuumState;
 
 
@@ -160,14 +160,14 @@ ginVacuumPostingTreeLeaves(GinVacuumState *gvs, BlockNumber blkno, bool isRoot,
    /*
     * We should be sure that we don't concurrent with inserts, insert process
     * never release root page until end (but it can unlock it and lock
-    * again). New scan can't start but previously started 
-    * ones work concurrently.
+    * again). New scan can't start but previously started ones work
+    * concurrently.
     */
 
-   if ( isRoot ) 
+   if (isRoot)
        LockBufferForCleanup(buffer);
    else
-       LockBuffer(buffer, GIN_EXCLUSIVE); 
+       LockBuffer(buffer, GIN_EXCLUSIVE);
 
    Assert(GinPageIsData(page));
 
@@ -240,8 +240,8 @@ ginDeletePage(GinVacuumState *gvs, BlockNumber deleteBlkno, BlockNumber leftBlkn
              BlockNumber parentBlkno, OffsetNumber myoff, bool isParentRoot)
 {
    Buffer      dBuffer = ReadBufferWithStrategy(gvs->index, deleteBlkno, gvs->strategy);
-   Buffer      lBuffer = (leftBlkno == InvalidBlockNumber) ? 
-                           InvalidBuffer : ReadBufferWithStrategy(gvs->index, leftBlkno, gvs->strategy);
+   Buffer      lBuffer = (leftBlkno == InvalidBlockNumber) ?
+   InvalidBuffer : ReadBufferWithStrategy(gvs->index, leftBlkno, gvs->strategy);
    Buffer      pBuffer = ReadBufferWithStrategy(gvs->index, parentBlkno, gvs->strategy);
    Page        page,
                parentPage;
@@ -268,17 +268,20 @@ ginDeletePage(GinVacuumState *gvs, BlockNumber deleteBlkno, BlockNumber leftBlkn
 
    parentPage = BufferGetPage(pBuffer);
 #ifdef USE_ASSERT_CHECKING
-   do {
-       PostingItem *tod=(PostingItem *) GinDataPageGetItem(parentPage, myoff);
-       Assert( PostingItemGetBlockNumber(tod) == deleteBlkno );
-   } while(0);
+   do
+   {
+       PostingItem *tod = (PostingItem *) GinDataPageGetItem(parentPage, myoff);
+
+       Assert(PostingItemGetBlockNumber(tod) == deleteBlkno);
+   } while (0);
 #endif
    PageDeletePostingItem(parentPage, myoff);
 
    page = BufferGetPage(dBuffer);
+
    /*
-    * we shouldn't change rightlink field to save 
-    * workability of running search scan
+    * we shouldn't change rightlink field to save workability of running
+    * search scan
     */
    GinPageGetOpaque(page)->flags = GIN_DELETED;
 
@@ -363,8 +366,8 @@ typedef struct DataPageDeleteStack
    struct DataPageDeleteStack *child;
    struct DataPageDeleteStack *parent;
 
-   BlockNumber blkno; /* current block number */
-   BlockNumber leftBlkno; /* rightest non-deleted page on left */
+   BlockNumber blkno;          /* current block number */
+   BlockNumber leftBlkno;      /* rightest non-deleted page on left */
    bool        isRoot;
 } DataPageDeleteStack;
 
index 79fbb496b54461cebb62dc693d2289ef3f5bc914..7649e4c9003dfbb46f0f598a9925ba3a0953e4f0 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *          $PostgreSQL: pgsql/src/backend/access/gin/ginxlog.c,v 1.10 2007/10/29 19:26:57 teodor Exp $
+ *          $PostgreSQL: pgsql/src/backend/access/gin/ginxlog.c,v 1.11 2007/11/15 21:14:31 momjian Exp $
  *-------------------------------------------------------------------------
  */
 #include "postgres.h"
@@ -135,7 +135,7 @@ ginRedoInsert(XLogRecPtr lsn, XLogRecord *record)
        Assert(data->isDelete == FALSE);
        Assert(GinPageIsData(page));
 
-       if ( ! XLByteLE(lsn, PageGetLSN(page)) )
+       if (!XLByteLE(lsn, PageGetLSN(page)))
        {
            if (data->isLeaf)
            {
@@ -170,6 +170,7 @@ ginRedoInsert(XLogRecPtr lsn, XLogRecord *record)
        if (!data->isLeaf && data->updateBlkno != InvalidBlockNumber)
        {
            PostingItem *pitem = (PostingItem *) (XLogRecGetData(record) + sizeof(ginxlogInsert));
+
            forgetIncompleteSplit(data->node, PostingItemGetBlockNumber(pitem), data->updateBlkno);
        }
 
@@ -180,7 +181,7 @@ ginRedoInsert(XLogRecPtr lsn, XLogRecord *record)
 
        Assert(!GinPageIsData(page));
 
-       if ( ! XLByteLE(lsn, PageGetLSN(page)) )
+       if (!XLByteLE(lsn, PageGetLSN(page)))
        {
            if (data->updateBlkno != InvalidBlockNumber)
            {
@@ -202,7 +203,7 @@ ginRedoInsert(XLogRecPtr lsn, XLogRecord *record)
 
            if (PageAddItem(page, (Item) itup, IndexTupleSize(itup), data->offset, false, false) == InvalidOffsetNumber)
                elog(ERROR, "failed to add item to index page in %u/%u/%u",
-                    data->node.spcNode, data->node.dbNode, data->node.relNode);
+                 data->node.spcNode, data->node.dbNode, data->node.relNode);
        }
 
        if (!data->isLeaf && data->updateBlkno != InvalidBlockNumber)
@@ -212,7 +213,7 @@ ginRedoInsert(XLogRecPtr lsn, XLogRecord *record)
        }
    }
 
-   if ( ! XLByteLE(lsn, PageGetLSN(page)) ) 
+   if (!XLByteLE(lsn, PageGetLSN(page)))
    {
        PageSetLSN(page, lsn);
        PageSetTLI(page, ThisTimeLineID);
index 0c1b94d7d380c76c648e8cffff3e3dbd09eaf992..770c2023bd76e1d429bbda9097a447c618bc109a 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.147 2007/09/20 17:56:30 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.148 2007/11/15 21:14:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -360,8 +360,8 @@ gistplacetopage(GISTInsertState *state, GISTSTATE *giststate)
            ptr->block.blkno = BufferGetBlockNumber(ptr->buffer);
 
            /*
-            * fill page, we can do it because all these pages are new
-            * (ie not linked in tree or masked by temp page
+            * fill page, we can do it because all these pages are new (ie not
+            * linked in tree or masked by temp page
             */
            data = (char *) (ptr->list);
            for (i = 0; i < ptr->block.num; i++)
index ba7a8ab959fd439018fbc1a78ade38f3083838b7..cb1919ac6e0d08593622a5a76791d693404b9a49 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.67 2007/09/12 22:10:25 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.68 2007/11/15 21:14:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -383,13 +383,12 @@ gistindex_keytest(IndexTuple tuple,
            /*
             * On non-leaf page we can't conclude that child hasn't NULL
             * values because of assumption in GiST: uinon (VAL, NULL) is VAL
-            * But if on non-leaf page key IS  NULL then all childs
-            * has NULL.
+            * But if on non-leaf page key IS  NULL then all childs has NULL.
             */
 
-           Assert( key->sk_flags & SK_SEARCHNULL );
+           Assert(key->sk_flags & SK_SEARCHNULL);
 
-           if ( GistPageIsLeaf(p) && !isNull )
+           if (GistPageIsLeaf(p) && !isNull)
                return false;
        }
        else if (isNull)
@@ -404,12 +403,14 @@ gistindex_keytest(IndexTuple tuple,
                           FALSE, isNull);
 
            /*
-            * Call the Consistent function to evaluate the test.  The arguments
-            * are the index datum (as a GISTENTRY*), the comparison datum, and
-            * the comparison operator's strategy number and subtype from pg_amop.
+            * Call the Consistent function to evaluate the test.  The
+            * arguments are the index datum (as a GISTENTRY*), the comparison
+            * datum, and the comparison operator's strategy number and
+            * subtype from pg_amop.
             *
-            * (Presently there's no need to pass the subtype since it'll always
-            * be zero, but might as well pass it for possible future use.)
+            * (Presently there's no need to pass the subtype since it'll
+            * always be zero, but might as well pass it for possible future
+            * use.)
             */
            test = FunctionCall4(&key->sk_func,
                                 PointerGetDatum(&de),
index 590be9133fbc5b04c13c7c443087f0e5a149afb2..e461b5923d946cba604300b383230af22fd0f63e 100644 (file)
@@ -10,7 +10,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/gist/gistproc.c,v 1.11 2007/09/07 17:04:26 teodor Exp $
+ * $PostgreSQL: pgsql/src/backend/access/gist/gistproc.c,v 1.12 2007/11/15 21:14:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -394,20 +394,22 @@ gist_box_picksplit(PG_FUNCTION_ARGS)
            ADDLIST(listT, unionT, posT, i);
    }
 
-#define LIMIT_RATIO    0.1
+#define LIMIT_RATIO 0.1
 #define _IS_BADRATIO(x,y)  ( (y) == 0 || (float)(x)/(float)(y) < LIMIT_RATIO )
 #define IS_BADRATIO(x,y) ( _IS_BADRATIO((x),(y)) || _IS_BADRATIO((y),(x)) )
    /* bad disposition, try to split by centers of boxes  */
-   if ( IS_BADRATIO(posR, posL) && IS_BADRATIO(posT, posB) )
+   if (IS_BADRATIO(posR, posL) && IS_BADRATIO(posT, posB))
    {
-       double  avgCenterX=0.0, avgCenterY=0.0;
-       double  CenterX, CenterY;
+       double      avgCenterX = 0.0,
+                   avgCenterY = 0.0;
+       double      CenterX,
+                   CenterY;
 
        for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
        {
            cur = DatumGetBoxP(entryvec->vector[i].key);
-           avgCenterX +=  ((double)cur->high.x + (double)cur->low.x)/2.0;
-           avgCenterY +=  ((double)cur->high.y + (double)cur->low.y)/2.0;
+           avgCenterX += ((double) cur->high.x + (double) cur->low.x) / 2.0;
+           avgCenterY += ((double) cur->high.y + (double) cur->low.y) / 2.0;
        }
 
        avgCenterX /= maxoff;
@@ -417,11 +419,11 @@ gist_box_picksplit(PG_FUNCTION_ARGS)
        for (i = FirstOffsetNumber; i <= maxoff; i = OffsetNumberNext(i))
        {
            cur = DatumGetBoxP(entryvec->vector[i].key);
-           
-           CenterX =  ((double)cur->high.x + (double)cur->low.x)/2.0;
-           CenterY =  ((double)cur->high.y + (double)cur->low.y)/2.0;
 
-           if (CenterX < avgCenterX) 
+           CenterX = ((double) cur->high.x + (double) cur->low.x) / 2.0;
+           CenterY = ((double) cur->high.y + (double) cur->low.y) / 2.0;
+
+           if (CenterX < avgCenterX)
                ADDLIST(listL, unionL, posL, i);
            else if (CenterX == avgCenterX)
            {
@@ -442,7 +444,7 @@ gist_box_picksplit(PG_FUNCTION_ARGS)
                else
                    ADDLIST(listB, unionB, posB, i);
            }
-           else 
+           else
                ADDLIST(listT, unionT, posT, i);
        }
    }
index 212995e7c5726b8fcb6ed27bd100c20f9fe3023d..dace2c89067ad16f23574607c291f4cb31fba955 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/access/gist/gistvacuum.c,v 1.32 2007/09/20 17:56:30 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/access/gist/gistvacuum.c,v 1.33 2007/11/15 21:14:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -35,7 +35,7 @@ typedef struct
    Relation    index;
    MemoryContext opCtx;
    GistBulkDeleteResult *result;
-   BufferAccessStrategy    strategy;
+   BufferAccessStrategy strategy;
 } GistVacuum;
 
 typedef struct
index d3f54c934be394ecaa5bd5198b87032133cad4cc..5933b02e8eb4f32c557212599d2ead6d26e5a554 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/access/hash/hash.c,v 1.96 2007/09/12 22:10:25 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/access/hash/hash.c,v 1.97 2007/11/15 21:14:32 momjian Exp $
  *
  * NOTES
  *   This file contains only the public interface routines.
@@ -548,7 +548,7 @@ loop_top:
            vacuum_delay_point();
 
            buf = _hash_getbuf_with_strategy(rel, blkno, HASH_WRITE,
-                                            LH_BUCKET_PAGE | LH_OVERFLOW_PAGE,
+                                          LH_BUCKET_PAGE | LH_OVERFLOW_PAGE,
                                             info->strategy);
            page = BufferGetPage(buf);
            opaque = (HashPageOpaque) PageGetSpecialPointer(page);
index 71fe34c8a20297a3e3014083a7cd3185aef969a9..4d1b1ed45cc2bf8ae1ee0417f21a27b7610d233e 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/access/hash/hashfunc.c,v 1.53 2007/09/21 22:52:52 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/access/hash/hashfunc.c,v 1.54 2007/11/15 21:14:32 momjian Exp $
  *
  * NOTES
  *   These functions are stored in pg_amproc.  For each operator class
@@ -103,8 +103,8 @@ hashfloat4(PG_FUNCTION_ARGS)
     * To support cross-type hashing of float8 and float4, we want to return
     * the same hash value hashfloat8 would produce for an equal float8 value.
     * So, widen the value to float8 and hash that.  (We must do this rather
-    * than have hashfloat8 try to narrow its value to float4; that could
-    * fail on overflow.)
+    * than have hashfloat8 try to narrow its value to float4; that could fail
+    * on overflow.)
     */
    key8 = key;
 
index e4ea24a62d1203f7496f62dba9ad7cb69166d201..c510c6e65b7778e3b9ebd0d801337530dd9c6257 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/access/hash/hashovfl.c,v 1.60 2007/09/20 17:56:30 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/access/hash/hashovfl.c,v 1.61 2007/11/15 21:14:32 momjian Exp $
  *
  * NOTES
  *   Overflow pages look like ordinary relation pages.
@@ -156,7 +156,7 @@ _hash_addovflpage(Relation rel, Buffer metabuf, Buffer buf)
 /*
  * _hash_getovflpage()
  *
- * Find an available overflow page and return it.  The returned buffer
+ * Find an available overflow page and return it.  The returned buffer
  * is pinned and write-locked, and has had _hash_pageinit() applied,
  * but it is caller's responsibility to fill the special space.
  *
@@ -402,9 +402,9 @@ _hash_freeovflpage(Relation rel, Buffer ovflbuf,
    bucket = ovflopaque->hasho_bucket;
 
    /*
-    * Zero the page for debugging's sake; then write and release it.
-    * (Note: if we failed to zero the page here, we'd have problems
-    * with the Assert in _hash_pageinit() when the page is reused.)
+    * Zero the page for debugging's sake; then write and release it. (Note:
+    * if we failed to zero the page here, we'd have problems with the Assert
+    * in _hash_pageinit() when the page is reused.)
     */
    MemSet(ovflpage, 0, BufferGetPageSize(ovflbuf));
    _hash_wrtbuf(rel, ovflbuf);
@@ -420,7 +420,7 @@ _hash_freeovflpage(Relation rel, Buffer ovflbuf,
        Buffer      prevbuf = _hash_getbuf_with_strategy(rel,
                                                         prevblkno,
                                                         HASH_WRITE,
-                                                        LH_BUCKET_PAGE | LH_OVERFLOW_PAGE,
+                                          LH_BUCKET_PAGE | LH_OVERFLOW_PAGE,
                                                         bstrategy);
        Page        prevpage = BufferGetPage(prevbuf);
        HashPageOpaque prevopaque = (HashPageOpaque) PageGetSpecialPointer(prevpage);
index 807dbed8a8c72783fc7acfeedb3f79e8ca024dc5..07f27001a898c793c53b5f1f8635a8121323f92d 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/access/hash/hashpage.c,v 1.70 2007/09/20 17:56:30 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/access/hash/hashpage.c,v 1.71 2007/11/15 21:14:32 momjian Exp $
  *
  * NOTES
  *   Postgres hash pages look like ordinary relation pages.  The opaque
@@ -37,7 +37,7 @@
 
 
 static bool _hash_alloc_buckets(Relation rel, BlockNumber firstblock,
-                               uint32 nblocks);
+                   uint32 nblocks);
 static void _hash_splitbucket(Relation rel, Buffer metabuf,
                  Bucket obucket, Bucket nbucket,
                  BlockNumber start_oblkno,
@@ -138,7 +138,7 @@ _hash_getbuf(Relation rel, BlockNumber blkno, int access, int flags)
  *
  *     This must be used only to fetch pages that are known to be before
  *     the index's filesystem EOF, but are to be filled from scratch.
- *     _hash_pageinit() is applied automatically.  Otherwise it has
+ *     _hash_pageinit() is applied automatically.  Otherwise it has
  *     effects similar to _hash_getbuf() with access = HASH_WRITE.
  *
  *     When this routine returns, a write lock is set on the
@@ -184,7 +184,7 @@ _hash_getinitbuf(Relation rel, BlockNumber blkno)
 Buffer
 _hash_getnewbuf(Relation rel, BlockNumber blkno)
 {
-   BlockNumber nblocks = RelationGetNumberOfBlocks(rel);
+   BlockNumber nblocks = RelationGetNumberOfBlocks(rel);
    Buffer      buf;
 
    if (blkno == P_NEW)
@@ -354,10 +354,10 @@ _hash_metapinit(Relation rel)
        ffactor = 10;
 
    /*
-    * We initialize the metapage, the first two bucket pages, and the
-    * first bitmap page in sequence, using _hash_getnewbuf to cause
-    * smgrextend() calls to occur.  This ensures that the smgr level
-    * has the right idea of the physical index length.
+    * We initialize the metapage, the first two bucket pages, and the first
+    * bitmap page in sequence, using _hash_getnewbuf to cause smgrextend()
+    * calls to occur.  This ensures that the smgr level has the right idea of
+    * the physical index length.
     */
    metabuf = _hash_getnewbuf(rel, HASH_METAPAGE);
    pg = BufferGetPage(metabuf);
@@ -501,15 +501,16 @@ _hash_expandtable(Relation rel, Buffer metabuf)
        goto fail;
 
    /*
-    * Can't split anymore if maxbucket has reached its maximum possible value.
+    * Can't split anymore if maxbucket has reached its maximum possible
+    * value.
     *
     * Ideally we'd allow bucket numbers up to UINT_MAX-1 (no higher because
     * the calculation maxbucket+1 mustn't overflow).  Currently we restrict
     * to half that because of overflow looping in _hash_log2() and
     * insufficient space in hashm_spares[].  It's moot anyway because an
-    * index with 2^32 buckets would certainly overflow BlockNumber and
-    * hence _hash_alloc_buckets() would fail, but if we supported buckets
-    * smaller than a disk block then this would be an independent constraint.
+    * index with 2^32 buckets would certainly overflow BlockNumber and hence
+    * _hash_alloc_buckets() would fail, but if we supported buckets smaller
+    * than a disk block then this would be an independent constraint.
     */
    if (metap->hashm_maxbucket >= (uint32) 0x7FFFFFFE)
        goto fail;
@@ -536,10 +537,10 @@ _hash_expandtable(Relation rel, Buffer metabuf)
    /*
     * Likewise lock the new bucket (should never fail).
     *
-    * Note: it is safe to compute the new bucket's blkno here, even though
-    * we may still need to update the BUCKET_TO_BLKNO mapping.  This is
-    * because the current value of hashm_spares[hashm_ovflpoint] correctly
-    * shows where we are going to put a new splitpoint's worth of buckets.
+    * Note: it is safe to compute the new bucket's blkno here, even though we
+    * may still need to update the BUCKET_TO_BLKNO mapping.  This is because
+    * the current value of hashm_spares[hashm_ovflpoint] correctly shows
+    * where we are going to put a new splitpoint's worth of buckets.
     */
    start_nblkno = BUCKET_TO_BLKNO(metap, new_bucket);
 
@@ -557,11 +558,12 @@ _hash_expandtable(Relation rel, Buffer metabuf)
    if (spare_ndx > metap->hashm_ovflpoint)
    {
        Assert(spare_ndx == metap->hashm_ovflpoint + 1);
+
        /*
-        * The number of buckets in the new splitpoint is equal to the
-        * total number already in existence, i.e. new_bucket.  Currently
-        * this maps one-to-one to blocks required, but someday we may need
-        * a more complicated calculation here.
+        * The number of buckets in the new splitpoint is equal to the total
+        * number already in existence, i.e. new_bucket.  Currently this maps
+        * one-to-one to blocks required, but someday we may need a more
+        * complicated calculation here.
         */
        if (!_hash_alloc_buckets(rel, start_nblkno, new_bucket))
        {
@@ -673,14 +675,14 @@ fail:
 static bool
 _hash_alloc_buckets(Relation rel, BlockNumber firstblock, uint32 nblocks)
 {
-   BlockNumber lastblock;
+   BlockNumber lastblock;
    char        zerobuf[BLCKSZ];
 
    lastblock = firstblock + nblocks - 1;
 
    /*
-    * Check for overflow in block number calculation; if so, we cannot
-    * extend the index anymore.
+    * Check for overflow in block number calculation; if so, we cannot extend
+    * the index anymore.
     */
    if (lastblock < firstblock || lastblock == InvalidBlockNumber)
        return false;
index 052393fc6b9a1bca61c3e3f73ec59a30b388e79c..20027592b500fd4250ad5475ad803021183765c5 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.244 2007/11/07 12:24:24 petere Exp $
+ *   $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.245 2007/11/15 21:14:32 momjian Exp $
  *
  *
  * INTERFACE ROUTINES
@@ -60,9 +60,9 @@
 
 
 static HeapScanDesc heap_beginscan_internal(Relation relation,
-                                           Snapshot snapshot,
-                                           int nkeys, ScanKey key,
-                                           bool is_bitmapscan);
+                       Snapshot snapshot,
+                       int nkeys, ScanKey key,
+                       bool is_bitmapscan);
 static XLogRecPtr log_heap_update(Relation reln, Buffer oldbuf,
           ItemPointerData from, Buffer newbuf, HeapTuple newtup, bool move);
 static bool HeapSatisfiesHOTUpdate(Relation relation, Bitmapset *hot_attrs,
@@ -85,18 +85,18 @@ initscan(HeapScanDesc scan, ScanKey key)
     * Determine the number of blocks we have to scan.
     *
     * It is sufficient to do this once at scan start, since any tuples added
-    * while the scan is in progress will be invisible to my snapshot
-    * anyway.  (That is not true when using a non-MVCC snapshot.  However,
-    * we couldn't guarantee to return tuples added after scan start anyway,
-    * since they might go into pages we already scanned.  To guarantee
-    * consistent results for a non-MVCC snapshot, the caller must hold some
-    * higher-level lock that ensures the interesting tuple(s) won't change.)
+    * while the scan is in progress will be invisible to my snapshot anyway.
+    * (That is not true when using a non-MVCC snapshot.  However, we couldn't
+    * guarantee to return tuples added after scan start anyway, since they
+    * might go into pages we already scanned.  To guarantee consistent
+    * results for a non-MVCC snapshot, the caller must hold some higher-level
+    * lock that ensures the interesting tuple(s) won't change.)
     */
    scan->rs_nblocks = RelationGetNumberOfBlocks(scan->rs_rd);
 
    /*
     * If the table is large relative to NBuffers, use a bulk-read access
-    * strategy and enable synchronized scanning (see syncscan.c).  Although
+    * strategy and enable synchronized scanning (see syncscan.c).  Although
     * the thresholds for these features could be different, we make them the
     * same so that there are only two behaviors to tune rather than four.
     *
@@ -140,8 +140,8 @@ initscan(HeapScanDesc scan, ScanKey key)
        memcpy(scan->rs_key, key, scan->rs_nkeys * sizeof(ScanKeyData));
 
    /*
-    * Currently, we don't have a stats counter for bitmap heap scans
-    * (but the underlying bitmap index scans will be counted).
+    * Currently, we don't have a stats counter for bitmap heap scans (but the
+    * underlying bitmap index scans will be counted).
     */
    if (!scan->rs_bitmapscan)
        pgstat_count_heap_scan(scan->rs_rd);
@@ -283,7 +283,7 @@ heapgettup(HeapScanDesc scan,
                tuple->t_data = NULL;
                return;
            }
-           page = scan->rs_startblock;         /* first page */
+           page = scan->rs_startblock; /* first page */
            heapgetpage(scan, page);
            lineoff = FirstOffsetNumber;        /* first offnum */
            scan->rs_inited = true;
@@ -317,6 +317,7 @@ heapgettup(HeapScanDesc scan,
                tuple->t_data = NULL;
                return;
            }
+
            /*
             * Disable reporting to syncscan logic in a backwards scan; it's
             * not very likely anyone else is doing the same thing at the same
@@ -459,9 +460,9 @@ heapgettup(HeapScanDesc scan,
            finished = (page == scan->rs_startblock);
 
            /*
-            * Report our new scan position for synchronization purposes.
-            * We don't do that when moving backwards, however. That would
-            * just mess up any other forward-moving scanners.
+            * Report our new scan position for synchronization purposes. We
+            * don't do that when moving backwards, however. That would just
+            * mess up any other forward-moving scanners.
             *
             * Note: we do this before checking for end of scan so that the
             * final state of the position hint is back at the start of the
@@ -554,7 +555,7 @@ heapgettup_pagemode(HeapScanDesc scan,
                tuple->t_data = NULL;
                return;
            }
-           page = scan->rs_startblock;         /* first page */
+           page = scan->rs_startblock; /* first page */
            heapgetpage(scan, page);
            lineindex = 0;
            scan->rs_inited = true;
@@ -585,6 +586,7 @@ heapgettup_pagemode(HeapScanDesc scan,
                tuple->t_data = NULL;
                return;
            }
+
            /*
             * Disable reporting to syncscan logic in a backwards scan; it's
             * not very likely anyone else is doing the same thing at the same
@@ -719,9 +721,9 @@ heapgettup_pagemode(HeapScanDesc scan,
            finished = (page == scan->rs_startblock);
 
            /*
-            * Report our new scan position for synchronization purposes.
-            * We don't do that when moving backwards, however. That would
-            * just mess up any other forward-moving scanners.
+            * Report our new scan position for synchronization purposes. We
+            * don't do that when moving backwards, however. That would just
+            * mess up any other forward-moving scanners.
             *
             * Note: we do this before checking for end of scan so that the
             * final state of the position hint is back at the start of the
@@ -1057,7 +1059,7 @@ heap_openrv(const RangeVar *relation, LOCKMODE lockmode)
  *     heap_beginscan  - begin relation scan
  *
  * heap_beginscan_bm is an alternative entry point for setting up a HeapScanDesc
- * for a bitmap heap scan.  Although that scan technology is really quite
+ * for a bitmap heap scan. Although that scan technology is really quite
  * unlike a standard seqscan, there is just enough commonality to make it
  * worth using the same data structure.
  * ----------------
@@ -1423,10 +1425,10 @@ bool
 heap_hot_search_buffer(ItemPointer tid, Buffer buffer, Snapshot snapshot,
                       bool *all_dead)
 {
-   Page dp = (Page) BufferGetPage(buffer);
+   Page        dp = (Page) BufferGetPage(buffer);
    TransactionId prev_xmax = InvalidTransactionId;
    OffsetNumber offnum;
-   bool at_chain_start;
+   bool        at_chain_start;
 
    if (all_dead)
        *all_dead = true;
@@ -1438,7 +1440,7 @@ heap_hot_search_buffer(ItemPointer tid, Buffer buffer, Snapshot snapshot,
    /* Scan through possible multiple members of HOT-chain */
    for (;;)
    {
-       ItemId lp;
+       ItemId      lp;
        HeapTupleData heapTuple;
 
        /* check for bogus TID */
@@ -1472,7 +1474,8 @@ heap_hot_search_buffer(ItemPointer tid, Buffer buffer, Snapshot snapshot,
            break;
 
        /*
-        * The xmin should match the previous xmax value, else chain is broken.
+        * The xmin should match the previous xmax value, else chain is
+        * broken.
         */
        if (TransactionIdIsValid(prev_xmax) &&
            !TransactionIdEquals(prev_xmax,
@@ -1499,8 +1502,8 @@ heap_hot_search_buffer(ItemPointer tid, Buffer buffer, Snapshot snapshot,
            *all_dead = false;
 
        /*
-        * Check to see if HOT chain continues past this tuple; if so
-        * fetch the next offnum and loop around.
+        * Check to see if HOT chain continues past this tuple; if so fetch
+        * the next offnum and loop around.
         */
        if (HeapTupleIsHotUpdated(&heapTuple))
        {
@@ -1511,7 +1514,7 @@ heap_hot_search_buffer(ItemPointer tid, Buffer buffer, Snapshot snapshot,
            prev_xmax = HeapTupleHeaderGetXmax(heapTuple.t_data);
        }
        else
-           break;          /* end of chain */
+           break;              /* end of chain */
    }
 
    return false;
@@ -1528,8 +1531,8 @@ bool
 heap_hot_search(ItemPointer tid, Relation relation, Snapshot snapshot,
                bool *all_dead)
 {
-   bool    result;
-   Buffer  buffer;
+   bool        result;
+   Buffer      buffer;
 
    buffer = ReadBuffer(relation, ItemPointerGetBlockNumber(tid));
    LockBuffer(buffer, BUFFER_LOCK_SHARE);
@@ -1665,7 +1668,7 @@ heap_get_latest_tid(Relation relation,
  *
  * This is called after we have waited for the XMAX transaction to terminate.
  * If the transaction aborted, we guarantee the XMAX_INVALID hint bit will
- * be set on exit.  If the transaction committed, we set the XMAX_COMMITTED
+ * be set on exit. If the transaction committed, we set the XMAX_COMMITTED
  * hint bit if possible --- but beware that that may not yet be possible,
  * if the transaction committed asynchronously.  Hence callers should look
  * only at XMAX_INVALID.
@@ -2069,7 +2072,7 @@ l1:
    /*
     * If this transaction commits, the tuple will become DEAD sooner or
     * later.  Set flag that this page is a candidate for pruning once our xid
-    * falls below the OldestXmin horizon.  If the transaction finally aborts,
+    * falls below the OldestXmin horizon.  If the transaction finally aborts,
     * the subsequent page pruning will be a no-op and the hint will be
     * cleared.
     */
@@ -2252,15 +2255,15 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
 
    /*
     * Fetch the list of attributes to be checked for HOT update.  This is
-    * wasted effort if we fail to update or have to put the new tuple on
-    * a different page.  But we must compute the list before obtaining
-    * buffer lock --- in the worst case, if we are doing an update on one
-    * of the relevant system catalogs, we could deadlock if we try to
-    * fetch the list later.  In any case, the relcache caches the data
-    * so this is usually pretty cheap.
+    * wasted effort if we fail to update or have to put the new tuple on a
+    * different page.  But we must compute the list before obtaining buffer
+    * lock --- in the worst case, if we are doing an update on one of the
+    * relevant system catalogs, we could deadlock if we try to fetch the list
+    * later.  In any case, the relcache caches the data so this is usually
+    * pretty cheap.
     *
-    * Note that we get a copy here, so we need not worry about relcache
-    * flush happening midway through.
+    * Note that we get a copy here, so we need not worry about relcache flush
+    * happening midway through.
     */
    hot_attrs = RelationGetIndexAttrBitmap(relation);
 
@@ -2555,7 +2558,7 @@ l2:
    {
        /*
         * Since the new tuple is going into the same page, we might be able
-        * to do a HOT update.  Check if any of the index columns have been
+        * to do a HOT update.  Check if any of the index columns have been
         * changed.  If not, then HOT update is possible.
         */
        if (HeapSatisfiesHOTUpdate(relation, hot_attrs, &oldtup, heaptup))
@@ -2573,14 +2576,14 @@ l2:
    /*
     * If this transaction commits, the old tuple will become DEAD sooner or
     * later.  Set flag that this page is a candidate for pruning once our xid
-    * falls below the OldestXmin horizon.  If the transaction finally aborts,
+    * falls below the OldestXmin horizon.  If the transaction finally aborts,
     * the subsequent page pruning will be a no-op and the hint will be
     * cleared.
     *
-    * XXX Should we set hint on newbuf as well?  If the transaction
-    * aborts, there would be a prunable tuple in the newbuf; but for now
-    * we choose not to optimize for aborts.  Note that heap_xlog_update
-    * must be kept in sync if this decision changes.
+    * XXX Should we set hint on newbuf as well?  If the transaction aborts,
+    * there would be a prunable tuple in the newbuf; but for now we choose
+    * not to optimize for aborts.  Note that heap_xlog_update must be kept in
+    * sync if this decision changes.
     */
    PageSetPrunable(dp, xid);
 
@@ -2695,22 +2698,24 @@ static bool
 heap_tuple_attr_equals(TupleDesc tupdesc, int attrnum,
                       HeapTuple tup1, HeapTuple tup2)
 {
-   Datum value1, value2;
-   bool isnull1, isnull2;
+   Datum       value1,
+               value2;
+   bool        isnull1,
+               isnull2;
    Form_pg_attribute att;
 
    /*
     * If it's a whole-tuple reference, say "not equal".  It's not really
-    * worth supporting this case, since it could only succeed after a
-    * no-op update, which is hardly a case worth optimizing for.
+    * worth supporting this case, since it could only succeed after a no-op
+    * update, which is hardly a case worth optimizing for.
     */
    if (attrnum == 0)
        return false;
 
    /*
-    * Likewise, automatically say "not equal" for any system attribute
-    * other than OID and tableOID; we cannot expect these to be consistent
-    * in a HOT chain, or even to be set correctly yet in the new tuple.
+    * Likewise, automatically say "not equal" for any system attribute other
+    * than OID and tableOID; we cannot expect these to be consistent in a HOT
+    * chain, or even to be set correctly yet in the new tuple.
     */
    if (attrnum < 0)
    {
@@ -2720,17 +2725,17 @@ heap_tuple_attr_equals(TupleDesc tupdesc, int attrnum,
    }
 
    /*
-    * Extract the corresponding values.  XXX this is pretty inefficient
-    * if there are many indexed columns.  Should HeapSatisfiesHOTUpdate
-    * do a single heap_deform_tuple call on each tuple, instead?  But
-    * that doesn't work for system columns ...
+    * Extract the corresponding values.  XXX this is pretty inefficient if
+    * there are many indexed columns.  Should HeapSatisfiesHOTUpdate do a
+    * single heap_deform_tuple call on each tuple, instead?  But that doesn't
+    * work for system columns ...
     */
    value1 = heap_getattr(tup1, attrnum, tupdesc, &isnull1);
    value2 = heap_getattr(tup2, attrnum, tupdesc, &isnull2);
 
    /*
-    * If one value is NULL and other is not, then they are certainly
-    * not equal
+    * If one value is NULL and other is not, then they are certainly not
+    * equal
     */
    if (isnull1 != isnull2)
        return false;
@@ -2744,7 +2749,7 @@ heap_tuple_attr_equals(TupleDesc tupdesc, int attrnum,
    /*
     * We do simple binary comparison of the two datums.  This may be overly
     * strict because there can be multiple binary representations for the
-    * same logical value.  But we should be OK as long as there are no false
+    * same logical value.  But we should be OK as long as there are no false
     * positives.  Using a type-specific equality operator is messy because
     * there could be multiple notions of equality in different operator
     * classes; furthermore, we cannot safely invoke user-defined functions
@@ -2758,7 +2763,7 @@ heap_tuple_attr_equals(TupleDesc tupdesc, int attrnum,
    else
    {
        Assert(attrnum <= tupdesc->natts);
-       att = tupdesc->attrs[attrnum - 1];
+       att = tupdesc->attrs[attrnum - 1];
        return datumIsEqual(value1, value2, att->attbyval, att->attlen);
    }
 }
@@ -2779,7 +2784,7 @@ static bool
 HeapSatisfiesHOTUpdate(Relation relation, Bitmapset *hot_attrs,
                       HeapTuple oldtup, HeapTuple newtup)
 {
-   int attrnum;
+   int         attrnum;
 
    while ((attrnum = bms_first_member(hot_attrs)) >= 0)
    {
@@ -3094,15 +3099,15 @@ l3:
    }
 
    /*
-    * We might already hold the desired lock (or stronger), possibly under
-    * a different subtransaction of the current top transaction.  If so,
-    * there is no need to change state or issue a WAL record.  We already
-    * handled the case where this is true for xmax being a MultiXactId,
-    * so now check for cases where it is a plain TransactionId.
+    * We might already hold the desired lock (or stronger), possibly under a
+    * different subtransaction of the current top transaction.  If so, there
+    * is no need to change state or issue a WAL record.  We already handled
+    * the case where this is true for xmax being a MultiXactId, so now check
+    * for cases where it is a plain TransactionId.
     *
     * Note in particular that this covers the case where we already hold
-    * exclusive lock on the tuple and the caller only wants shared lock.
-    * It would certainly not do to give up the exclusive lock.
+    * exclusive lock on the tuple and the caller only wants shared lock. It
+    * would certainly not do to give up the exclusive lock.
     */
    xmax = HeapTupleHeaderGetXmax(tuple->t_data);
    old_infomask = tuple->t_data->t_infomask;
@@ -3179,8 +3184,8 @@ l3:
            {
                /*
                 * If the XMAX is a valid TransactionId, then we need to
-                * create a new MultiXactId that includes both the old
-                * locker and our own TransactionId.
+                * create a new MultiXactId that includes both the old locker
+                * and our own TransactionId.
                 */
                xid = MultiXactIdCreate(xmax, xid);
                new_infomask |= HEAP_XMAX_IS_MULTI;
@@ -3214,8 +3219,8 @@ l3:
    /*
     * Store transaction information of xact locking the tuple.
     *
-    * Note: Cmax is meaningless in this context, so don't set it; this
-    * avoids possibly generating a useless combo CID.
+    * Note: Cmax is meaningless in this context, so don't set it; this avoids
+    * possibly generating a useless combo CID.
     */
    tuple->t_data->t_infomask = new_infomask;
    HeapTupleHeaderClearHotUpdated(tuple->t_data);
@@ -3425,6 +3430,7 @@ heap_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
            buf = InvalidBuffer;
        }
        HeapTupleHeaderSetXmin(tuple, FrozenTransactionId);
+
        /*
         * Might as well fix the hint bits too; usually XMIN_COMMITTED will
         * already be set here, but there's a small chance not.
@@ -3437,9 +3443,9 @@ heap_freeze_tuple(HeapTupleHeader tuple, TransactionId cutoff_xid,
    /*
     * When we release shared lock, it's possible for someone else to change
     * xmax before we get the lock back, so repeat the check after acquiring
-    * exclusive lock.  (We don't need this pushup for xmin, because only
-    * VACUUM could be interested in changing an existing tuple's xmin,
-    * and there's only one VACUUM allowed on a table at a time.)
+    * exclusive lock.  (We don't need this pushup for xmin, because only
+    * VACUUM could be interested in changing an existing tuple's xmin, and
+    * there's only one VACUUM allowed on a table at a time.)
     */
 recheck_xmax:
    if (!(tuple->t_infomask & HEAP_XMAX_IS_MULTI))
@@ -3454,13 +3460,14 @@ recheck_xmax:
                LockBuffer(buf, BUFFER_LOCK_UNLOCK);
                LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
                buf = InvalidBuffer;
-               goto recheck_xmax;          /* see comment above */
+               goto recheck_xmax;      /* see comment above */
            }
            HeapTupleHeaderSetXmax(tuple, InvalidTransactionId);
+
            /*
-            * The tuple might be marked either XMAX_INVALID or
-            * XMAX_COMMITTED + LOCKED.  Normalize to INVALID just to be
-            * sure no one gets confused.
+            * The tuple might be marked either XMAX_INVALID or XMAX_COMMITTED
+            * + LOCKED.  Normalize to INVALID just to be sure no one gets
+            * confused.
             */
            tuple->t_infomask &= ~HEAP_XMAX_COMMITTED;
            tuple->t_infomask |= HEAP_XMAX_INVALID;
@@ -3506,8 +3513,9 @@ recheck_xvac:
                LockBuffer(buf, BUFFER_LOCK_UNLOCK);
                LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
                buf = InvalidBuffer;
-               goto recheck_xvac;          /* see comment above */
+               goto recheck_xvac;      /* see comment above */
            }
+
            /*
             * If a MOVED_OFF tuple is not dead, the xvac transaction must
             * have failed; whereas a non-dead MOVED_IN tuple must mean the
@@ -3517,9 +3525,10 @@ recheck_xvac:
                HeapTupleHeaderSetXvac(tuple, InvalidTransactionId);
            else
                HeapTupleHeaderSetXvac(tuple, FrozenTransactionId);
+
            /*
-            * Might as well fix the hint bits too; usually XMIN_COMMITTED will
-            * already be set here, but there's a small chance not.
+            * Might as well fix the hint bits too; usually XMIN_COMMITTED
+            * will already be set here, but there's a small chance not.
             */
            Assert(!(tuple->t_infomask & HEAP_XMIN_INVALID));
            tuple->t_infomask |= HEAP_XMIN_COMMITTED;
@@ -3632,8 +3641,8 @@ log_heap_clean(Relation reln, Buffer buffer,
    /*
     * The OffsetNumber arrays are not actually in the buffer, but we pretend
     * that they are.  When XLogInsert stores the whole buffer, the offset
-    * arrays need not be stored too.  Note that even if all three arrays
-    * are empty, we want to expose the buffer as a candidate for whole-page
+    * arrays need not be stored too.  Note that even if all three arrays are
+    * empty, we want to expose the buffer as a candidate for whole-page
     * storage, since this record type implies a defragmentation operation
     * even if no item pointers changed state.
     */
@@ -3686,7 +3695,7 @@ log_heap_clean(Relation reln, Buffer buffer,
 }
 
 /*
- * Perform XLogInsert for a heap-freeze operation.  Caller must already
+ * Perform XLogInsert for a heap-freeze operation. Caller must already
  * have modified the buffer and marked it dirty.
  */
 XLogRecPtr
@@ -3711,9 +3720,9 @@ log_heap_freeze(Relation reln, Buffer buffer,
    rdata[0].next = &(rdata[1]);
 
    /*
-    * The tuple-offsets array is not actually in the buffer, but pretend
-    * that it is.  When XLogInsert stores the whole buffer, the offsets array
-    * need not be stored too.
+    * The tuple-offsets array is not actually in the buffer, but pretend that
+    * it is.  When XLogInsert stores the whole buffer, the offsets array need
+    * not be stored too.
     */
    if (offcnt > 0)
    {
@@ -3853,7 +3862,7 @@ log_heap_move(Relation reln, Buffer oldbuf, ItemPointerData from,
  * for writing the page to disk after calling this routine.
  *
  * Note: all current callers build pages in private memory and write them
- * directly to smgr, rather than using bufmgr.  Therefore there is no need
+ * directly to smgr, rather than using bufmgr. Therefore there is no need
  * to pass a buffer ID to XLogInsert, nor to perform MarkBufferDirty within
  * the critical section.
  *
@@ -3905,9 +3914,9 @@ heap_xlog_clean(XLogRecPtr lsn, XLogRecord *record, bool clean_move)
    Page        page;
    OffsetNumber *offnum;
    OffsetNumber *end;
-   int nredirected;
-   int ndead;
-   int i;
+   int         nredirected;
+   int         ndead;
+   int         i;
 
    if (record->xl_info & XLR_BKP_BLOCK_1)
        return;
@@ -3934,12 +3943,12 @@ heap_xlog_clean(XLogRecPtr lsn, XLogRecord *record, bool clean_move)
    {
        OffsetNumber fromoff = *offnum++;
        OffsetNumber tooff = *offnum++;
-       ItemId  fromlp = PageGetItemId(page, fromoff);
+       ItemId      fromlp = PageGetItemId(page, fromoff);
 
        if (clean_move)
        {
            /* Physically move the "to" item to the "from" slot */
-           ItemId  tolp = PageGetItemId(page, tooff);
+           ItemId      tolp = PageGetItemId(page, tooff);
            HeapTupleHeader htup;
 
            *fromlp = *tolp;
@@ -3962,7 +3971,7 @@ heap_xlog_clean(XLogRecPtr lsn, XLogRecord *record, bool clean_move)
    for (i = 0; i < ndead; i++)
    {
        OffsetNumber off = *offnum++;
-       ItemId  lp = PageGetItemId(page, off);
+       ItemId      lp = PageGetItemId(page, off);
 
        ItemIdSetDead(lp);
    }
@@ -3971,14 +3980,14 @@ heap_xlog_clean(XLogRecPtr lsn, XLogRecord *record, bool clean_move)
    while (offnum < end)
    {
        OffsetNumber off = *offnum++;
-       ItemId  lp = PageGetItemId(page, off);
+       ItemId      lp = PageGetItemId(page, off);
 
        ItemIdSetUnused(lp);
    }
 
    /*
-    * Finally, repair any fragmentation, and update the page's hint bit
-    * about whether it has free pointers.
+    * Finally, repair any fragmentation, and update the page's hint bit about
+    * whether it has free pointers.
     */
    PageRepairFragmentation(page);
 
@@ -4617,7 +4626,7 @@ heap_desc(StringInfo buf, uint8 xl_info, char *rec)
    {
        xl_heap_update *xlrec = (xl_heap_update *) rec;
 
-       if (xl_info & XLOG_HEAP_INIT_PAGE) /* can this case happen? */
+       if (xl_info & XLOG_HEAP_INIT_PAGE)      /* can this case happen? */
            appendStringInfo(buf, "hot_update(init): ");
        else
            appendStringInfo(buf, "hot_update: ");
@@ -4724,7 +4733,7 @@ heap_sync(Relation rel)
    /* toast heap, if any */
    if (OidIsValid(rel->rd_rel->reltoastrelid))
    {
-       Relation        toastrel;
+       Relation    toastrel;
 
        toastrel = heap_open(rel->rd_rel->reltoastrelid, AccessShareLock);
        FlushRelationBuffers(toastrel);
index 9723241547ff2ea1947d6c5999c6d4d6b75cbc7e..067b23f24cca2386b24fe09eb06c5bc83fbf32de 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/access/heap/pruneheap.c,v 1.3 2007/10/24 13:05:57 tgl Exp $
+ *   $PostgreSQL: pgsql/src/backend/access/heap/pruneheap.c,v 1.4 2007/11/15 21:14:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 
 
 /* Local functions */
-static int heap_prune_chain(Relation relation, Buffer buffer,
-                            OffsetNumber rootoffnum,
-                            TransactionId OldestXmin,
-                            OffsetNumber *redirected, int *nredirected,
-                            OffsetNumber *nowdead, int *ndead,
-                            OffsetNumber *nowunused, int *nunused,
-                            bool redirect_move);
+static int heap_prune_chain(Relation relation, Buffer buffer,
+                OffsetNumber rootoffnum,
+                TransactionId OldestXmin,
+                OffsetNumber *redirected, int *nredirected,
+                OffsetNumber *nowdead, int *ndead,
+                OffsetNumber *nowunused, int *nunused,
+                bool redirect_move);
 static void heap_prune_record_redirect(OffsetNumber *redirected,
-           int *nredirected,
-           OffsetNumber offnum,
-           OffsetNumber rdoffnum);
+                          int *nredirected,
+                          OffsetNumber offnum,
+                          OffsetNumber rdoffnum);
 static void heap_prune_record_dead(OffsetNumber *nowdead, int *ndead,
-           OffsetNumber offnum);
+                      OffsetNumber offnum);
 static void heap_prune_record_unused(OffsetNumber *nowunused, int *nunused,
-           OffsetNumber offnum);
+                        OffsetNumber offnum);
 
 
 /*
@@ -70,16 +70,16 @@ heap_page_prune_opt(Relation relation, Buffer buffer, TransactionId OldestXmin)
        return;
 
    /*
-    * We prune when a previous UPDATE failed to find enough space on the
-    * page for a new tuple version, or when free space falls below the
-    * relation's fill-factor target (but not less than 10%).
+    * We prune when a previous UPDATE failed to find enough space on the page
+    * for a new tuple version, or when free space falls below the relation's
+    * fill-factor target (but not less than 10%).
     *
-    * Checking free space here is questionable since we aren't holding
-    * any lock on the buffer; in the worst case we could get a bogus
-    * answer.  It's unlikely to be *seriously* wrong, though, since
-    * reading either pd_lower or pd_upper is probably atomic.  Avoiding
-    * taking a lock seems better than sometimes getting a wrong answer
-    * in what is after all just a heuristic estimate.
+    * Checking free space here is questionable since we aren't holding any
+    * lock on the buffer; in the worst case we could get a bogus answer.
+    * It's unlikely to be *seriously* wrong, though, since reading either
+    * pd_lower or pd_upper is probably atomic.  Avoiding taking a lock seems
+    * better than sometimes getting a wrong answer in what is after all just
+    * a heuristic estimate.
     */
    minfree = RelationGetTargetPageFreeSpace(relation,
                                             HEAP_DEFAULT_FILLFACTOR);
@@ -93,9 +93,9 @@ heap_page_prune_opt(Relation relation, Buffer buffer, TransactionId OldestXmin)
 
        /*
         * Now that we have buffer lock, get accurate information about the
-        * page's free space, and recheck the heuristic about whether to prune.
-        * (We needn't recheck PageIsPrunable, since no one else could have
-        * pruned while we hold pin.)
+        * page's free space, and recheck the heuristic about whether to
+        * prune. (We needn't recheck PageIsPrunable, since no one else could
+        * have pruned while we hold pin.)
         */
        if (PageIsFull(dp) || PageGetHeapFreeSpace((Page) dp) < minfree)
        {
@@ -119,7 +119,7 @@ heap_page_prune_opt(Relation relation, Buffer buffer, TransactionId OldestXmin)
  *
  * If redirect_move is set, we remove redirecting line pointers by
  * updating the root line pointer to point directly to the first non-dead
- * tuple in the chain.  NOTE: eliminating the redirect changes the first
+ * tuple in the chain. NOTE: eliminating the redirect changes the first
  * tuple's effective CTID, and is therefore unsafe except within VACUUM FULL.
  * The only reason we support this capability at all is that by using it,
  * VACUUM FULL need not cope with LP_REDIRECT items at all; which seems a
@@ -136,18 +136,18 @@ int
 heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin,
                bool redirect_move, bool report_stats)
 {
-   int             ndeleted = 0;
-   Page            page = BufferGetPage(buffer);
-   OffsetNumber    offnum,
-                   maxoff;
-   OffsetNumber    redirected[MaxHeapTuplesPerPage * 2];
-   OffsetNumber    nowdead[MaxHeapTuplesPerPage];
-   OffsetNumber    nowunused[MaxHeapTuplesPerPage];
-   int             nredirected = 0;
-   int             ndead = 0;
-   int             nunused = 0;
-   bool            page_was_full = false;
-   TransactionId   save_prune_xid;
+   int         ndeleted = 0;
+   Page        page = BufferGetPage(buffer);
+   OffsetNumber offnum,
+               maxoff;
+   OffsetNumber redirected[MaxHeapTuplesPerPage * 2];
+   OffsetNumber nowdead[MaxHeapTuplesPerPage];
+   OffsetNumber nowunused[MaxHeapTuplesPerPage];
+   int         nredirected = 0;
+   int         ndead = 0;
+   int         nunused = 0;
+   bool        page_was_full = false;
+   TransactionId save_prune_xid;
 
    START_CRIT_SECTION();
 
@@ -159,7 +159,7 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin,
    save_prune_xid = ((PageHeader) page)->pd_prune_xid;
    PageClearPrunable(page);
 
-   /* 
+   /*
     * Also clear the "page is full" flag if it is set, since there's no point
     * in repeating the prune/defrag process until something else happens to
     * the page.
@@ -176,7 +176,7 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin,
         offnum <= maxoff;
         offnum = OffsetNumberNext(offnum))
    {
-       ItemId itemid = PageGetItemId(page, offnum);
+       ItemId      itemid = PageGetItemId(page, offnum);
 
        /* Nothing to do if slot is empty or already dead */
        if (!ItemIdIsUsed(itemid) || ItemIdIsDead(itemid))
@@ -233,9 +233,9 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin,
    END_CRIT_SECTION();
 
    /*
-    * If requested, report the number of tuples reclaimed to pgstats.
-    * This is ndeleted minus ndead, because we don't want to count a now-DEAD
-    * root item as a deletion for this purpose.
+    * If requested, report the number of tuples reclaimed to pgstats. This is
+    * ndeleted minus ndead, because we don't want to count a now-DEAD root
+    * item as a deletion for this purpose.
     */
    if (report_stats && ndeleted > ndead)
        pgstat_update_heap_dead_tuples(relation, ndeleted - ndead);
@@ -243,19 +243,17 @@ heap_page_prune(Relation relation, Buffer buffer, TransactionId OldestXmin,
    /*
     * XXX Should we update the FSM information of this page ?
     *
-    * There are two schools of thought here. We may not want to update
-    * FSM information so that the page is not used for unrelated
-    * UPDATEs/INSERTs and any free space in this page will remain
-    * available for further UPDATEs in *this* page, thus improving
-    * chances for doing HOT updates.
+    * There are two schools of thought here. We may not want to update FSM
+    * information so that the page is not used for unrelated UPDATEs/INSERTs
+    * and any free space in this page will remain available for further
+    * UPDATEs in *this* page, thus improving chances for doing HOT updates.
     *
-    * But for a large table and where a page does not receive further
-    * UPDATEs for a long time, we might waste this space by not
-    * updating the FSM information. The relation may get extended and
-    * fragmented further.
+    * But for a large table and where a page does not receive further UPDATEs
+    * for a long time, we might waste this space by not updating the FSM
+    * information. The relation may get extended and fragmented further.
     *
-    * One possibility is to leave "fillfactor" worth of space in this
-    * page and update FSM with the remaining space.
+    * One possibility is to leave "fillfactor" worth of space in this page
+    * and update FSM with the remaining space.
     *
     * In any case, the current FSM implementation doesn't accept
     * one-page-at-a-time updates, so this is all academic for now.
@@ -298,17 +296,17 @@ heap_prune_chain(Relation relation, Buffer buffer, OffsetNumber rootoffnum,
                 OffsetNumber *nowunused, int *nunused,
                 bool redirect_move)
 {
-   int             ndeleted = 0;
-   Page            dp = (Page) BufferGetPage(buffer);
-   TransactionId   priorXmax = InvalidTransactionId;
-   ItemId          rootlp;
-   HeapTupleHeader htup;
-   OffsetNumber    latestdead = InvalidOffsetNumber,
-                   maxoff = PageGetMaxOffsetNumber(dp),
-                   offnum;
-   OffsetNumber    chainitems[MaxHeapTuplesPerPage];
-   int             nchain = 0,
-                   i;
+   int         ndeleted = 0;
+   Page        dp = (Page) BufferGetPage(buffer);
+   TransactionId priorXmax = InvalidTransactionId;
+   ItemId      rootlp;
+   HeapTupleHeader htup;
+   OffsetNumber latestdead = InvalidOffsetNumber,
+               maxoff = PageGetMaxOffsetNumber(dp),
+               offnum;
+   OffsetNumber chainitems[MaxHeapTuplesPerPage];
+   int         nchain = 0,
+               i;
 
    rootlp = PageGetItemId(dp, rootoffnum);