1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Major code cleanups from D'arcy (-Wall -Werror)

This commit is contained in:
Marc G. Fournier
1996-10-23 07:42:13 +00:00
parent 29a0fb84fc
commit f36b2560a4
44 changed files with 249 additions and 147 deletions

View File

@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.9 1996/10/21 09:37:26 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.10 1996/10/23 07:39:53 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
@@ -177,7 +177,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
Oid *elements;
Datum value;
bool isnull = (bool) true;
char *nulls;
char *nulls = NULL;
char *string;
int32 ntuples;
TupleDesc tupDesc;
@@ -189,8 +189,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
tupDesc = rel->rd_att;
if (!binary) {
out_functions = (func_ptr *)
palloc(attr_count * sizeof(func_ptr));
out_functions = (func_ptr *) palloc(attr_count * sizeof(func_ptr));
elements = (Oid *) palloc(attr_count * sizeof(Oid));
for (i = 0; i < attr_count; i++) {
out_func_oid = (Oid) GetOutputFunction(attr[i]->atttypid);
@@ -198,6 +197,8 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
elements[i] = GetTypeElement(attr[i]->atttypid);
}
}else {
elements = NULL;
out_functions = NULL;
nulls = (char *) palloc(attr_count);
for (i = 0; i < attr_count; i++) nulls[i] = ' ';
@@ -295,23 +296,25 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
bool isnull;
bool has_index;
int done = 0;
char *string, *ptr;
char *string = NULL, *ptr;
Relation *index_rels;
int32 len, null_ct, null_id;
int32 ntuples, tuples_read = 0;
bool reading_to_eof = true;
Oid *elements;
FuncIndexInfo *finfo, **finfoP;
FuncIndexInfo *finfo, **finfoP = NULL;
TupleDesc *itupdescArr;
HeapTuple pgIndexTup;
IndexTupleForm *pgIndexP;
int *indexNatts;
IndexTupleForm *pgIndexP = NULL;
int *indexNatts = NULL;
char *predString;
Node **indexPred;
Node **indexPred = NULL;
TupleDesc rtupdesc;
ExprContext *econtext;
ExprContext *econtext = NULL;
#ifndef OMIT_PARTIAL_INDEX
TupleTable tupleTable;
TupleTableSlot *slot;
TupleTableSlot *slot = NULL;
#endif
int natts;
AttrNumber *attnumP;
Datum idatum;
@@ -416,6 +419,8 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
}
else
{
in_functions = NULL;
elements = NULL;
fread(&ntuples, sizeof(int32), 1, fp);
if (ntuples != 0) reading_to_eof = false;
}
@@ -874,7 +879,7 @@ CopyAttributeOut(FILE *fp, char *string, char *delim)
if (len && (string[0] == '{') && (string[len-1] == '}'))
is_array = true;
for ( ; c = *string; string++) {
for ( ; (c = *string) != 0; string++) {
if (c == delim[0] || c == '\n' ||
(c == '\\' && !is_array))
fputc('\\', fp);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.4 1996/08/26 06:30:23 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.5 1996/10/23 07:39:57 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
@@ -129,8 +129,6 @@ DefineIndex(char *heapRelationName,
* -- JMH, 7/22/96
*/
foreach(pl, parameterList) {
int count;
char *ptr;
ParamString *param = (ParamString*)lfirst(pl);
if (!strcasecmp(param->name, "islossy"))
@@ -138,7 +136,6 @@ DefineIndex(char *heapRelationName,
}
/*
* Convert the partial-index predicate from parsetree form to plan
* form, so it can be readily evaluated during index creation.

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.1.1.1 1996/07/09 06:21:20 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/define.c,v 1.2 1996/10/23 07:40:01 scrappy Exp $
*
* DESCRIPTION
* The "DefineFoo" routines take the parse tree and pick out the
@@ -42,6 +42,7 @@
#include "catalog/pg_aggregate.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
#include "catalog/pg_operator.h"
#include "utils/syscache.h"
#include "nodes/pg_list.h"
#include "nodes/parsenodes.h"
@@ -74,10 +75,9 @@ DefineFunction(ProcedureStmt *stmt, CommandDest dest)
char* prosrc_str;
char *prorettype;
char *languageName;
bool canCache;
bool trusted = TRUE;
bool canCache = FALSE;
List *argList;
int32 byte_pct, perbyte_cpu, percall_cpu, outin_ratio;
int32 byte_pct = 100, perbyte_cpu, percall_cpu, outin_ratio = 100;
bool returnsSet;
int i;
@@ -112,7 +112,6 @@ DefineFunction(ProcedureStmt *stmt, CommandDest dest)
List *pl;
/* the defaults */
canCache = FALSE;
byte_pct = BYTE_PCT;
perbyte_cpu = PERBYTE_CPU;
percall_cpu = PERCALL_CPU;
@@ -165,12 +164,8 @@ DefineFunction(ProcedureStmt *stmt, CommandDest dest)
}
}
} else if (!strcmp(languageName, "sql")) {
canCache = false;
trusted = true;
/* query optimizer groks sql, these are meaningless */
perbyte_cpu = percall_cpu = 0;
byte_pct = outin_ratio = 100;
} else {
elog(WARN, "DefineFunction: language '%s' is not supported",
languageName);
@@ -208,7 +203,7 @@ DefineFunction(ProcedureStmt *stmt, CommandDest dest)
prosrc_str, /* converted to text later */
probin_str, /* converted to text later */
canCache,
trusted,
TRUE,
byte_pct,
perbyte_cpu,
percall_cpu,

View File

@@ -7,10 +7,12 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.1.1.1 1996/07/09 06:21:21 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.2 1996/10/23 07:40:08 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#include <stdio.h>
#include "postgres.h"
#include "parser/catalog_utils.h"
#include "parser/parse_query.h" /* for MakeTimeRange() */
@@ -157,6 +159,7 @@ explain_outNode(StringInfo str, Plan *plan, int indent, ExplainState *es)
pname = "Tee";
break;
default:
pname = NULL;
break;
}

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.2 1996/08/19 01:53:39 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.3 1996/10/23 07:40:09 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
@@ -321,7 +321,7 @@ RemoveFunction(char *functionName, /* function name to be removed */
Buffer buffer = InvalidBuffer;
bool bufferUsed = FALSE;
Oid argList[8];
Form_pg_proc the_proc;
Form_pg_proc the_proc = NULL;
ItemPointerData itemPointerData;
static ScanKeyData key[3] = {
{ 0, Anum_pg_proc_proname, NameEqualRegProcedure }

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.4 1996/10/18 08:13:36 vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.5 1996/10/23 07:40:10 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,6 +34,7 @@
#include "storage/bufmgr.h"
#include "storage/bufpage.h"
#include "storage/smgr.h"
#include "storage/lmgr.h"
#include "utils/elog.h"
#include "utils/mcxt.h"
@@ -206,7 +207,7 @@ _vc_getrels(Portal p, NameData *VacRelP)
Buffer buf;
PortalVariableMemory portalmem;
MemoryContext old;
VRelList vrl, cur;
VRelList vrl, cur = NULL;
Datum d;
char *rname;
char rkind;
@@ -404,7 +405,7 @@ _vc_vacheap(Portal p, VRelList curvrl, Relation onerel)
Buffer buf;
Page page;
OffsetNumber offnum, maxoff;
Relation archrel;
Relation archrel = NULL;
bool isarchived;
int nvac;
int ntups;
@@ -883,7 +884,7 @@ _vc_free(Portal p, VRelList vrl)
{
VRelList p_vrl;
VAttList p_val, val;
VPageDescr p_vpd, *vpd;
VPageDescr *vpd;
int i;
MemoryContext old;
PortalVariableMemory pmem;