Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
75fee453
Commit
75fee453
authored
Nov 11, 2002
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Back out use of palloc0 in place if palloc/MemSet. Seems constant len
to MemSet is a performance boost.
parent
5d283d89
Changes
38
Hide whitespace changes
Inline
Side-by-side
Showing
38 changed files
with
212 additions
and
110 deletions
+212
-110
contrib/dblink/dblink.c
contrib/dblink/dblink.c
+2
-1
contrib/intarray/_int.c
contrib/intarray/_int.c
+3
-1
src/backend/access/common/indextuple.c
src/backend/access/common/indextuple.c
+3
-2
src/backend/access/common/tupdesc.c
src/backend/access/common/tupdesc.c
+3
-2
src/backend/access/gist/gist.c
src/backend/access/gist/gist.c
+5
-3
src/backend/access/nbtree/nbtsort.c
src/backend/access/nbtree/nbtsort.c
+7
-3
src/backend/access/rtree/rtproc.c
src/backend/access/rtree/rtproc.c
+7
-3
src/backend/catalog/index.c
src/backend/catalog/index.c
+3
-2
src/backend/commands/analyze.c
src/backend/commands/analyze.c
+3
-2
src/backend/commands/copy.c
src/backend/commands/copy.c
+3
-2
src/backend/commands/explain.c
src/backend/commands/explain.c
+3
-2
src/backend/commands/opclasscmds.c
src/backend/commands/opclasscmds.c
+7
-4
src/backend/commands/prepare.c
src/backend/commands/prepare.c
+3
-2
src/backend/commands/trigger.c
src/backend/commands/trigger.c
+22
-7
src/backend/commands/vacuumlazy.c
src/backend/commands/vacuumlazy.c
+3
-2
src/backend/executor/execMain.c
src/backend/executor/execMain.c
+12
-3
src/backend/executor/functions.c
src/backend/executor/functions.c
+6
-3
src/backend/executor/nodeAgg.c
src/backend/executor/nodeAgg.c
+13
-7
src/backend/executor/nodeAppend.c
src/backend/executor/nodeAppend.c
+3
-2
src/backend/executor/nodeSort.c
src/backend/executor/nodeSort.c
+5
-3
src/backend/executor/spi.c
src/backend/executor/spi.c
+6
-3
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/path/allpaths.c
+3
-2
src/backend/parser/parse_func.c
src/backend/parser/parse_func.c
+3
-2
src/backend/parser/parse_node.c
src/backend/parser/parse_node.c
+3
-2
src/backend/postmaster/postmaster.c
src/backend/postmaster/postmaster.c
+4
-2
src/backend/utils/adt/acl.c
src/backend/utils/adt/acl.c
+3
-2
src/backend/utils/adt/arrayfuncs.c
src/backend/utils/adt/arrayfuncs.c
+13
-6
src/backend/utils/adt/geo_ops.c
src/backend/utils/adt/geo_ops.c
+6
-3
src/backend/utils/adt/network.c
src/backend/utils/adt/network.c
+9
-5
src/backend/utils/adt/varbit.c
src/backend/utils/adt/varbit.c
+7
-4
src/backend/utils/cache/catcache.c
src/backend/utils/cache/catcache.c
+3
-2
src/backend/utils/cache/relcache.c
src/backend/utils/cache/relcache.c
+12
-5
src/backend/utils/fmgr/fmgr.c
src/backend/utils/fmgr/fmgr.c
+3
-2
src/backend/utils/sort/tuplesort.c
src/backend/utils/sort/tuplesort.c
+8
-4
src/backend/utils/sort/tuplestore.c
src/backend/utils/sort/tuplestore.c
+4
-2
src/include/c.h
src/include/c.h
+2
-3
src/pl/plpgsql/src/pl_exec.c
src/pl/plpgsql/src/pl_exec.c
+4
-3
src/test/regress/regress.c
src/test/regress/regress.c
+3
-2
No files found.
contrib/dblink/dblink.c
View file @
75fee453
...
...
@@ -1442,7 +1442,8 @@ init_dblink_results(MemoryContext fn_mcxt)
oldcontext
=
MemoryContextSwitchTo
(
fn_mcxt
);
retval
=
(
dblink_results
*
)
palloc0
(
sizeof
(
dblink_results
));
retval
=
(
dblink_results
*
)
palloc
(
sizeof
(
dblink_results
));
MemSet
(
retval
,
0
,
sizeof
(
dblink_results
));
retval
->
tup_num
=
-
1
;
retval
->
res_id_index
=
-
1
;
...
...
contrib/intarray/_int.c
View file @
75fee453
...
...
@@ -916,8 +916,10 @@ new_intArrayType(int num)
ArrayType
*
r
;
int
nbytes
=
ARR_OVERHEAD
(
NDIM
)
+
sizeof
(
int
)
*
num
;
r
=
(
ArrayType
*
)
palloc
0
(
nbytes
);
r
=
(
ArrayType
*
)
palloc
(
nbytes
);
MemSet
(
r
,
0
,
nbytes
);
ARR_SIZE
(
r
)
=
nbytes
;
ARR_NDIM
(
r
)
=
NDIM
;
ARR_ELEMTYPE
(
r
)
=
INT4OID
;
...
...
src/backend/access/common/indextuple.c
View file @
75fee453
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.6
1 2002/11/10 07:25:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.6
2 2002/11/11 03:02:18
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -121,8 +121,9 @@ index_formtuple(TupleDesc tupleDescriptor,
#endif
size
=
MAXALIGN
(
size
);
/* be conservative */
tp
=
(
char
*
)
palloc
0
(
size
);
tp
=
(
char
*
)
palloc
(
size
);
tuple
=
(
IndexTuple
)
tp
;
MemSet
(
tp
,
0
,
size
);
DataFill
((
char
*
)
tp
+
hoff
,
tupleDescriptor
,
...
...
src/backend/access/common/tupdesc.c
View file @
75fee453
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.9
2 2002/11/10 07:25:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.9
3 2002/11/11 03:02:18
momjian Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
...
...
@@ -60,7 +60,8 @@ CreateTemplateTupleDesc(int natts, bool hasoid)
{
uint32
size
=
natts
*
sizeof
(
Form_pg_attribute
);
desc
->
attrs
=
(
Form_pg_attribute
*
)
palloc0
(
size
);
desc
->
attrs
=
(
Form_pg_attribute
*
)
palloc
(
size
);
MemSet
(
desc
->
attrs
,
0
,
size
);
}
else
desc
->
attrs
=
NULL
;
...
...
src/backend/access/gist/gist.c
View file @
75fee453
...
...
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.9
7 2002/11/10 07:25:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.9
8 2002/11/11 03:02:18
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1316,8 +1316,10 @@ gistSplit(Relation r,
*/
if
(
r
->
rd_att
->
natts
>
1
)
{
v
.
spl_idgrp
=
(
int
*
)
palloc0
(
sizeof
(
int
)
*
(
*
len
+
1
));
v
.
spl_grpflag
=
(
char
*
)
palloc0
(
sizeof
(
char
)
*
(
*
len
+
1
));
v
.
spl_idgrp
=
(
int
*
)
palloc
(
sizeof
(
int
)
*
(
*
len
+
1
));
MemSet
((
void
*
)
v
.
spl_idgrp
,
0
,
sizeof
(
int
)
*
(
*
len
+
1
));
v
.
spl_grpflag
=
(
char
*
)
palloc
(
sizeof
(
char
)
*
(
*
len
+
1
));
MemSet
((
void
*
)
v
.
spl_grpflag
,
0
,
sizeof
(
char
)
*
(
*
len
+
1
));
v
.
spl_ngrp
=
(
int
*
)
palloc
(
sizeof
(
int
)
*
(
*
len
+
1
));
MaxGrpId
=
gistfindgroup
(
giststate
,
(
GISTENTRY
*
)
VARDATA
(
entryvec
),
&
v
);
...
...
src/backend/access/nbtree/nbtsort.c
View file @
75fee453
...
...
@@ -35,7 +35,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v 1.6
7 2002/11/10 07:25:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v 1.6
8 2002/11/11 03:02:18
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -111,7 +111,9 @@ static void _bt_load(Relation index, BTSpool *btspool, BTSpool *btspool2);
BTSpool
*
_bt_spoolinit
(
Relation
index
,
bool
isunique
)
{
BTSpool
*
btspool
=
(
BTSpool
*
)
palloc0
(
sizeof
(
BTSpool
));
BTSpool
*
btspool
=
(
BTSpool
*
)
palloc
(
sizeof
(
BTSpool
));
MemSet
((
char
*
)
btspool
,
0
,
sizeof
(
BTSpool
));
btspool
->
index
=
index
;
btspool
->
isunique
=
isunique
;
...
...
@@ -205,7 +207,9 @@ _bt_blnewpage(Relation index, Buffer *buf, Page *page, int flags)
static
BTPageState
*
_bt_pagestate
(
Relation
index
,
int
flags
,
int
level
)
{
BTPageState
*
state
=
(
BTPageState
*
)
palloc0
(
sizeof
(
BTPageState
));
BTPageState
*
state
=
(
BTPageState
*
)
palloc
(
sizeof
(
BTPageState
));
MemSet
((
char
*
)
state
,
0
,
sizeof
(
BTPageState
));
/* create initial page */
_bt_blnewpage
(
index
,
&
(
state
->
btps_buf
),
&
(
state
->
btps_page
),
flags
);
...
...
src/backend/access/rtree/rtproc.c
View file @
75fee453
...
...
@@ -15,7 +15,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.3
4 2002/11/10 07:25:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.3
5 2002/11/11 03:02:18
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -103,7 +103,9 @@ rt_poly_union(PG_FUNCTION_ARGS)
POLYGON
*
b
=
PG_GETARG_POLYGON_P
(
1
);
POLYGON
*
p
;
p
=
(
POLYGON
*
)
palloc0
(
sizeof
(
POLYGON
));
/* zero any holes */
p
=
(
POLYGON
*
)
palloc
(
sizeof
(
POLYGON
));
MemSet
((
char
*
)
p
,
0
,
sizeof
(
POLYGON
));
/* zero any holes */
p
->
size
=
sizeof
(
POLYGON
);
p
->
npts
=
0
;
p
->
boundbox
.
high
.
x
=
Max
(
a
->
boundbox
.
high
.
x
,
b
->
boundbox
.
high
.
x
);
...
...
@@ -125,7 +127,9 @@ rt_poly_inter(PG_FUNCTION_ARGS)
POLYGON
*
b
=
PG_GETARG_POLYGON_P
(
1
);
POLYGON
*
p
;
p
=
(
POLYGON
*
)
palloc0
(
sizeof
(
POLYGON
));
/* zero any holes */
p
=
(
POLYGON
*
)
palloc
(
sizeof
(
POLYGON
));
MemSet
((
char
*
)
p
,
0
,
sizeof
(
POLYGON
));
/* zero any holes */
p
->
size
=
sizeof
(
POLYGON
);
p
->
npts
=
0
;
p
->
boundbox
.
high
.
x
=
Min
(
a
->
boundbox
.
high
.
x
,
b
->
boundbox
.
high
.
x
);
...
...
src/backend/catalog/index.c
View file @
75fee453
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.20
3 2002/11/10 07:25:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.20
4 2002/11/11 03:02:18
momjian Exp $
*
*
* INTERFACE ROUTINES
...
...
@@ -112,7 +112,8 @@ BuildFuncTupleDesc(Oid funcOid,
* Allocate and zero a tuple descriptor for a one-column tuple.
*/
funcTupDesc
=
CreateTemplateTupleDesc
(
1
,
false
);
funcTupDesc
->
attrs
[
0
]
=
(
Form_pg_attribute
)
palloc0
(
ATTRIBUTE_TUPLE_SIZE
);
funcTupDesc
->
attrs
[
0
]
=
(
Form_pg_attribute
)
palloc
(
ATTRIBUTE_TUPLE_SIZE
);
MemSet
(
funcTupDesc
->
attrs
[
0
],
0
,
ATTRIBUTE_TUPLE_SIZE
);
/*
* Lookup the function to get its name and return type.
...
...
src/backend/commands/analyze.c
View file @
75fee453
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.4
8 2002/11/10 07:25:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.4
9 2002/11/11 03:02:18
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -423,7 +423,8 @@ examine_attribute(Relation onerel, int attnum)
* If we have "=" then we're at least able to do the minimal
* algorithm, so start filling in a VacAttrStats struct.
*/
stats
=
(
VacAttrStats
*
)
palloc0
(
sizeof
(
VacAttrStats
));
stats
=
(
VacAttrStats
*
)
palloc
(
sizeof
(
VacAttrStats
));
MemSet
(
stats
,
0
,
sizeof
(
VacAttrStats
));
stats
->
attnum
=
attnum
;
stats
->
attr
=
(
Form_pg_attribute
)
palloc
(
ATTRIBUTE_TUPLE_SIZE
);
memcpy
(
stats
->
attr
,
attr
,
ATTRIBUTE_TUPLE_SIZE
);
...
...
src/backend/commands/copy.c
View file @
75fee453
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.17
8 2002/11/10 07:25:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.17
9 2002/11/11 03:02:18
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -804,8 +804,9 @@ CopyFrom(Relation rel, List *attnumlist, bool binary, bool oids,
elements
=
(
Oid
*
)
palloc
(
num_phys_attrs
*
sizeof
(
Oid
));
defmap
=
(
int
*
)
palloc
(
num_phys_attrs
*
sizeof
(
int
));
defexprs
=
(
Node
**
)
palloc
(
num_phys_attrs
*
sizeof
(
Node
*
));
constraintexprs
=
(
Node
**
)
palloc
0
(
num_phys_attrs
*
sizeof
(
Node
*
));
constraintexprs
=
(
Node
**
)
palloc
(
num_phys_attrs
*
sizeof
(
Node
*
));
constraintconsts
=
(
Const
**
)
palloc
(
num_phys_attrs
*
sizeof
(
Const
*
));
MemSet
(
constraintexprs
,
0
,
num_phys_attrs
*
sizeof
(
Node
*
));
for
(
i
=
0
;
i
<
num_phys_attrs
;
i
++
)
{
...
...
src/backend/commands/explain.c
View file @
75fee453
...
...
@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994-5, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.9
1 2002/11/10 07:25:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/explain.c,v 1.9
2 2002/11/11 03:02:18
momjian Exp $
*
*/
...
...
@@ -164,7 +164,8 @@ ExplainOneQuery(Query *query, ExplainStmt *stmt, TupOutputState *tstate)
(
double
)
endtime
.
tv_usec
/
1000000
.
0
;
}
es
=
(
ExplainState
*
)
palloc0
(
sizeof
(
ExplainState
));
es
=
(
ExplainState
*
)
palloc
(
sizeof
(
ExplainState
));
MemSet
(
es
,
0
,
sizeof
(
ExplainState
));
es
->
printCost
=
true
;
/* default */
...
...
src/backend/commands/opclasscmds.c
View file @
75fee453
...
...
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/opclasscmds.c,v 1.
7 2002/11/10 07:25:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/opclasscmds.c,v 1.
8 2002/11/11 03:02:18
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -124,9 +124,12 @@ DefineOpClass(CreateOpClassStmt *stmt)
* do this mainly so that we can detect duplicate strategy numbers and
* support-proc numbers.
*/
operators
=
(
Oid
*
)
palloc0
(
sizeof
(
Oid
)
*
numOperators
);
procedures
=
(
Oid
*
)
palloc0
(
sizeof
(
Oid
)
*
numProcs
);
recheck
=
(
bool
*
)
palloc0
(
sizeof
(
bool
)
*
numOperators
);
operators
=
(
Oid
*
)
palloc
(
sizeof
(
Oid
)
*
numOperators
);
MemSet
(
operators
,
0
,
sizeof
(
Oid
)
*
numOperators
);
procedures
=
(
Oid
*
)
palloc
(
sizeof
(
Oid
)
*
numProcs
);
MemSet
(
procedures
,
0
,
sizeof
(
Oid
)
*
numProcs
);
recheck
=
(
bool
*
)
palloc
(
sizeof
(
bool
)
*
numOperators
);
MemSet
(
recheck
,
0
,
sizeof
(
bool
)
*
numOperators
);
/*
* Scan the "items" list to obtain additional info.
...
...
src/backend/commands/prepare.c
View file @
75fee453
...
...
@@ -6,7 +6,7 @@
* Copyright (c) 2002, PostgreSQL Global Development Group
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/prepare.c,v 1.
5 2002/11/10 07:25:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/prepare.c,v 1.
6 2002/11/11 03:02:18
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -116,7 +116,8 @@ ExecuteQuery(ExecuteStmt *stmt, CommandDest outputDest)
if
(
nargs
!=
length
(
stmt
->
params
))
elog
(
ERROR
,
"ExecuteQuery: wrong number of arguments"
);
paramLI
=
(
ParamListInfo
)
palloc0
((
nargs
+
1
)
*
sizeof
(
ParamListInfoData
));
paramLI
=
(
ParamListInfo
)
palloc
((
nargs
+
1
)
*
sizeof
(
ParamListInfoData
));
MemSet
(
paramLI
,
0
,
(
nargs
+
1
)
*
sizeof
(
ParamListInfoData
));
foreach
(
l
,
stmt
->
params
)
{
...
...
src/backend/commands/trigger.c
View file @
75fee453
...
...
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.13
7 2002/11/10 07:25:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/trigger.c,v 1.13
8 2002/11/11 03:02:18
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -94,7 +94,7 @@ CreateTrigger(CreateTrigStmt *stmt, bool forConstraint)
constrrelid
=
RangeVarGetRelid
(
stmt
->
constrrel
,
false
);
else
if
(
stmt
->
isconstraint
)
{
/*
/*
* If this trigger is a constraint (and a foreign key one)
* then we really need a constrrelid. Since we don't have one,
* we'll try to generate one from the argument information.
...
...
@@ -779,7 +779,8 @@ RelationBuildTriggers(Relation relation)
RelationGetRelationName
(
relation
));
/* Build trigdesc */
trigdesc
=
(
TriggerDesc
*
)
palloc0
(
sizeof
(
TriggerDesc
));
trigdesc
=
(
TriggerDesc
*
)
palloc
(
sizeof
(
TriggerDesc
));
MemSet
(
trigdesc
,
0
,
sizeof
(
TriggerDesc
));
trigdesc
->
triggers
=
triggers
;
trigdesc
->
numtriggers
=
ntrigs
;
for
(
found
=
0
;
found
<
ntrigs
;
found
++
)
...
...
@@ -1145,8 +1146,12 @@ ExecBRInsertTriggers(EState *estate, ResultRelInfo *relinfo,
/* Allocate cache space for fmgr lookup info, if not done yet */
if
(
relinfo
->
ri_TrigFunctions
==
NULL
)
{
relinfo
->
ri_TrigFunctions
=
(
FmgrInfo
*
)
palloc0
(
trigdesc
->
numtriggers
*
sizeof
(
FmgrInfo
));
palloc
(
trigdesc
->
numtriggers
*
sizeof
(
FmgrInfo
));
MemSet
(
relinfo
->
ri_TrigFunctions
,
0
,
trigdesc
->
numtriggers
*
sizeof
(
FmgrInfo
));
}
LocTriggerData
.
type
=
T_TriggerData
;
LocTriggerData
.
tg_event
=
TRIGGER_EVENT_INSERT
|
TRIGGER_EVENT_ROW
|
TRIGGER_EVENT_BEFORE
;
...
...
@@ -1201,8 +1206,12 @@ ExecBRDeleteTriggers(EState *estate, ResultRelInfo *relinfo,
/* Allocate cache space for fmgr lookup info, if not done yet */
if
(
relinfo
->
ri_TrigFunctions
==
NULL
)
{
relinfo
->
ri_TrigFunctions
=
(
FmgrInfo
*
)
palloc0
(
trigdesc
->
numtriggers
*
sizeof
(
FmgrInfo
));
palloc
(
trigdesc
->
numtriggers
*
sizeof
(
FmgrInfo
));
MemSet
(
relinfo
->
ri_TrigFunctions
,
0
,
trigdesc
->
numtriggers
*
sizeof
(
FmgrInfo
));
}
LocTriggerData
.
type
=
T_TriggerData
;
LocTriggerData
.
tg_event
=
TRIGGER_EVENT_DELETE
|
TRIGGER_EVENT_ROW
|
TRIGGER_EVENT_BEFORE
;
...
...
@@ -1273,8 +1282,12 @@ ExecBRUpdateTriggers(EState *estate, ResultRelInfo *relinfo,
/* Allocate cache space for fmgr lookup info, if not done yet */
if
(
relinfo
->
ri_TrigFunctions
==
NULL
)
{
relinfo
->
ri_TrigFunctions
=
(
FmgrInfo
*
)
palloc0
(
trigdesc
->
numtriggers
*
sizeof
(
FmgrInfo
));
palloc
(
trigdesc
->
numtriggers
*
sizeof
(
FmgrInfo
));
MemSet
(
relinfo
->
ri_TrigFunctions
,
0
,
trigdesc
->
numtriggers
*
sizeof
(
FmgrInfo
));
}
LocTriggerData
.
type
=
T_TriggerData
;
LocTriggerData
.
tg_event
=
TRIGGER_EVENT_UPDATE
|
TRIGGER_EVENT_ROW
|
TRIGGER_EVENT_BEFORE
;
...
...
@@ -1756,7 +1769,9 @@ deferredTriggerInvokeEvents(bool immediate_only)
* Allocate space to cache fmgr lookup info for triggers.
*/
finfo
=
(
FmgrInfo
*
)
palloc0
(
trigdesc
->
numtriggers
*
sizeof
(
FmgrInfo
));
palloc
(
trigdesc
->
numtriggers
*
sizeof
(
FmgrInfo
));
MemSet
(
finfo
,
0
,
trigdesc
->
numtriggers
*
sizeof
(
FmgrInfo
));
}
DeferredTriggerExecute
(
event
,
i
,
rel
,
trigdesc
,
finfo
,
...
...
src/backend/commands/vacuumlazy.c
View file @
75fee453
...
...
@@ -31,7 +31,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuumlazy.c,v 1.2
1 2002/11/10 07:25:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/vacuumlazy.c,v 1.2
2 2002/11/11 03:02:18
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -147,7 +147,8 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt)
vacuum_set_xid_limits
(
vacstmt
,
onerel
->
rd_rel
->
relisshared
,
&
OldestXmin
,
&
FreezeLimit
);
vacrelstats
=
(
LVRelStats
*
)
palloc0
(
sizeof
(
LVRelStats
));
vacrelstats
=
(
LVRelStats
*
)
palloc
(
sizeof
(
LVRelStats
));
MemSet
(
vacrelstats
,
0
,
sizeof
(
LVRelStats
));
/* Open all indexes of the relation */
vac_open_indexes
(
onerel
,
&
nindexes
,
&
Irel
);
...
...
src/backend/executor/execMain.c
View file @
75fee453
...
...
@@ -27,7 +27,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.18
2 2002/11/10 07:25:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.18
3 2002/11/11 03:02:18
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -106,8 +106,12 @@ ExecutorStart(QueryDesc *queryDesc, EState *estate)
Assert
(
queryDesc
!=
NULL
);
if
(
queryDesc
->
plantree
->
nParamExec
>
0
)
{
estate
->
es_param_exec_vals
=
(
ParamExecData
*
)
palloc0
(
queryDesc
->
plantree
->
nParamExec
*
sizeof
(
ParamExecData
));
palloc
(
queryDesc
->
plantree
->
nParamExec
*
sizeof
(
ParamExecData
));
MemSet
(
estate
->
es_param_exec_vals
,
0
,
queryDesc
->
plantree
->
nParamExec
*
sizeof
(
ParamExecData
));
}
/*
* Make our own private copy of the current query snapshot data.
...
...
@@ -1788,12 +1792,17 @@ EvalPlanQual(EState *estate, Index rti, ItemPointer tid)
*/
epqstate
->
es_evTupleNull
=
(
bool
*
)
palloc
(
rtsize
*
sizeof
(
bool
));
if
(
epq
==
NULL
)
{
/* first PQ stack entry */
epqstate
->
es_evTuple
=
(
HeapTuple
*
)
palloc0
(
rtsize
*
sizeof
(
HeapTuple
));
palloc
(
rtsize
*
sizeof
(
HeapTuple
));
memset
(
epqstate
->
es_evTuple
,
0
,
rtsize
*
sizeof
(
HeapTuple
));
}
else
{
/* later stack entries share the same storage */
epqstate
->
es_evTuple
=
epq
->
estate
.
es_evTuple
;
}
}
else
{
...
...
src/backend/executor/functions.c
View file @
75fee453
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.5
8 2002/11/10 07:25:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.5
9 2002/11/11 03:02:18
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -121,7 +121,9 @@ init_execution_state(char *src, Oid *argOidVect, int nargs)
int
i
;
ParamListInfo
paramLI
;
paramLI
=
(
ParamListInfo
)
palloc0
((
nargs
+
1
)
*
sizeof
(
ParamListInfoData
));
paramLI
=
(
ParamListInfo
)
palloc
((
nargs
+
1
)
*
sizeof
(
ParamListInfoData
));
MemSet
(
paramLI
,
0
,
(
nargs
+
1
)
*
sizeof
(
ParamListInfoData
));
estate
->
es_param_list_info
=
paramLI
;
...
...
@@ -183,7 +185,8 @@ init_sql_fcache(FmgrInfo *finfo)
typeStruct
=
(
Form_pg_type
)
GETSTRUCT
(
typeTuple
);
fcache
=
(
SQLFunctionCachePtr
)
palloc0
(
sizeof
(
SQLFunctionCache
));
fcache
=
(
SQLFunctionCachePtr
)
palloc
(
sizeof
(
SQLFunctionCache
));
MemSet
(
fcache
,
0
,
sizeof
(
SQLFunctionCache
));
/*
* get the type length and by-value flag from the type tuple
...
...
src/backend/executor/nodeAgg.c
View file @
75fee453
...
...
@@ -45,7 +45,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.9
3 2002/11/10 07:25:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.9
4 2002/11/11 03:02:18
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -651,7 +651,8 @@ lookup_hash_entry(Agg *node, TupleTableSlot *slot)
MemoryContextSwitchTo
(
aggstate
->
aggcontext
);
entrysize
=
sizeof
(
AggHashEntryData
)
+
(
aggstate
->
numaggs
-
1
)
*
sizeof
(
AggStatePerGroupData
);
entry
=
(
AggHashEntry
)
palloc0
(
entrysize
);
entry
=
(
AggHashEntry
)
palloc
(
entrysize
);
MemSet
(
entry
,
0
,
entrysize
);
entry
->
hashkey
=
hashkey
;
entry
->
firstTuple
=
heap_copytuple
(
tuple
);
...
...
@@ -887,8 +888,9 @@ agg_retrieve_direct(Agg *node)
Datum
*
dvalues
;
char
*
dnulls
;
dvalues
=
(
Datum
*
)
palloc
0
(
sizeof
(
Datum
)
*
tupType
->
natts
);
dvalues
=
(
Datum
*
)
palloc
(
sizeof
(
Datum
)
*
tupType
->
natts
);
dnulls
=
(
char
*
)
palloc
(
sizeof
(
char
)
*
tupType
->
natts
);
MemSet
(
dvalues
,
0
,
sizeof
(
Datum
)
*
tupType
->
natts
);
MemSet
(
dnulls
,
'n'
,
sizeof
(
char
)
*
tupType
->
natts
);
nullsTuple
=
heap_formtuple
(
tupType
,
dvalues
,
dnulls
);
ExecStoreTuple
(
nullsTuple
,
...
...
@@ -1168,10 +1170,13 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent)
* allocate my private per-agg working storage
*/
econtext
=
aggstate
->
csstate
.
cstate
.
cs_ExprContext
;
econtext
->
ecxt_aggvalues
=
(
Datum
*
)
palloc0
(
sizeof
(
Datum
)
*
numaggs
);
econtext
->
ecxt_aggnulls
=
(
bool
*
)
palloc0
(
sizeof
(
bool
)
*
numaggs
);
econtext
->
ecxt_aggvalues
=
(
Datum
*
)
palloc
(
sizeof
(
Datum
)
*
numaggs
);
MemSet
(
econtext
->
ecxt_aggvalues
,
0
,
sizeof
(
Datum
)
*
numaggs
);
econtext
->
ecxt_aggnulls
=
(
bool
*
)
palloc
(
sizeof
(
bool
)
*
numaggs
);
MemSet
(
econtext
->
ecxt_aggnulls
,
0
,
sizeof
(
bool
)
*
numaggs
);
peragg
=
(
AggStatePerAgg
)
palloc0
(
sizeof
(
AggStatePerAggData
)
*
numaggs
);
peragg
=
(
AggStatePerAgg
)
palloc
(
sizeof
(
AggStatePerAggData
)
*
numaggs
);
MemSet
(
peragg
,
0
,
sizeof
(
AggStatePerAggData
)
*
numaggs
);
aggstate
->
peragg
=
peragg
;
if
(
node
->
aggstrategy
==
AGG_HASHED
)
...
...
@@ -1183,7 +1188,8 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent)
{
AggStatePerGroup
pergroup
;
pergroup
=
(
AggStatePerGroup
)
palloc0
(
sizeof
(
AggStatePerGroupData
)
*
numaggs
);
pergroup
=
(
AggStatePerGroup
)
palloc
(
sizeof
(
AggStatePerGroupData
)
*
numaggs
);
MemSet
(
pergroup
,
0
,
sizeof
(
AggStatePerGroupData
)
*
numaggs
);
aggstate
->
pergroup
=
pergroup
;
}
...
...
src/backend/executor/nodeAppend.c
View file @
75fee453
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.4
8 2002/11/10 07:25:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.4
9 2002/11/11 03:02:18
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -166,7 +166,8 @@ ExecInitAppend(Append *node, EState *estate, Plan *parent)
appendplans
=
node
->
appendplans
;
nplans
=
length
(
appendplans
);
initialized
=
(
bool
*
)
palloc0
(
nplans
*
sizeof
(
bool
));
initialized
=
(
bool
*
)
palloc
(
nplans
*
sizeof
(
bool
));
MemSet
(
initialized
,
0
,
nplans
*
sizeof
(
bool
));
/*
* create new AppendState for our append node
...
...
src/backend/executor/nodeSort.c
View file @
75fee453
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.3
8 2002/11/10 07:25:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.3
9 2002/11/11 03:02:19
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -50,9 +50,11 @@ ExtractSortKeys(Sort *sortnode,
*/
if
(
keycount
<=
0
)
elog
(
ERROR
,
"ExtractSortKeys: keycount <= 0"
);
sortOps
=
(
Oid
*
)
palloc0
(
keycount
*
sizeof
(
Oid
));
sortOps
=
(
Oid
*
)
palloc
(
keycount
*
sizeof
(
Oid
));
MemSet
(
sortOps
,
0
,
keycount
*
sizeof
(
Oid
));
*
sortOperators
=
sortOps
;
attNos
=
(
AttrNumber
*
)
palloc0
(
keycount
*
sizeof
(
AttrNumber
));
attNos
=
(
AttrNumber
*
)
palloc
(
keycount
*
sizeof
(
AttrNumber
));
MemSet
(
attNos
,
0
,
keycount
*
sizeof
(
AttrNumber
));
*
attNums
=
attNos
;
/*
...
...
src/backend/executor/spi.c
View file @
75fee453
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.7
6 2002/11/10 07:25:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.7
7 2002/11/11 03:02:19
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -783,8 +783,9 @@ SPI_cursor_open(char *name, void *plan, Datum *Values, char *Nulls)
{
ParamListInfo
paramLI
;
paramLI
=
(
ParamListInfo
)
palloc
0
((
spiplan
->
nargs
+
1
)
*
paramLI
=
(
ParamListInfo
)
palloc
((
spiplan
->
nargs
+
1
)
*
sizeof
(
ParamListInfoData
));
MemSet
(
paramLI
,
0
,
(
spiplan
->
nargs
+
1
)
*
sizeof
(
ParamListInfoData
));
eState
->
es_param_list_info
=
paramLI
;
for
(
k
=
0
;
k
<
spiplan
->
nargs
;
paramLI
++
,
k
++
)
...
...
@@ -1192,7 +1193,9 @@ _SPI_execute_plan(_SPI_plan *plan, Datum *Values, char *Nulls, int tcount)
int
k
;
paramLI
=
(
ParamListInfo
)
palloc0
((
nargs
+
1
)
*
sizeof
(
ParamListInfoData
));
palloc
((
nargs
+
1
)
*
sizeof
(
ParamListInfoData
));
MemSet
(
paramLI
,
0
,
(
nargs
+
1
)
*
sizeof
(
ParamListInfoData
));
state
->
es_param_list_info
=
paramLI
;
for
(
k
=
0
;
k
<
plan
->
nargs
;
paramLI
++
,
k
++
)
...
...
src/backend/optimizer/path/allpaths.c
View file @
75fee453
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.9
0 2002/11/10 07:25:13
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.9
1 2002/11/11 03:02:19
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -460,7 +460,8 @@ make_one_rel_by_joins(Query *root, int levels_needed, List *initial_rels)
* joinitems[j] is a list of all the j-item rels. Initially we set
* joinitems[1] to represent all the single-jointree-item relations.
*/
joinitems
=
(
List
**
)
palloc0
((
levels_needed
+
1
)
*
sizeof
(
List
*
));
joinitems
=
(
List
**
)
palloc
((
levels_needed
+
1
)
*
sizeof
(
List
*
));
MemSet
(
joinitems
,
0
,
(
levels_needed
+
1
)
*
sizeof
(
List
*
));
joinitems
[
1
]
=
initial_rels
;
...
...
src/backend/parser/parse_func.c
View file @
75fee453
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.14
0 2002/11/10 07:25:14
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.14
1 2002/11/11 03:02:19
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1070,7 +1070,8 @@ gen_cross_product(InhPaths *arginh, int nargs)
/* compute the cross product from right to left */
for
(;;)
{
oneres
=
(
Oid
*
)
palloc0
(
FUNC_MAX_ARGS
*
sizeof
(
Oid
));
oneres
=
(
Oid
*
)
palloc
(
FUNC_MAX_ARGS
*
sizeof
(
Oid
));
MemSet
(
oneres
,
0
,
FUNC_MAX_ARGS
*
sizeof
(
Oid
));
for
(
i
=
nargs
-
1
;
i
>=
0
&&
cur
[
i
]
>
arginh
[
i
].
nsupers
;
i
--
)
continue
;
...
...
src/backend/parser/parse_node.c
View file @
75fee453
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.7
0 2002/11/10 07:25:14
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/parse_node.c,v 1.7
1 2002/11/11 03:02:19
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -40,7 +40,8 @@ make_parsestate(ParseState *parentParseState)
{
ParseState
*
pstate
;
pstate
=
palloc0
(
sizeof
(
ParseState
));
pstate
=
palloc
(
sizeof
(
ParseState
));
MemSet
(
pstate
,
0
,
sizeof
(
ParseState
));
pstate
->
parentParseState
=
parentParseState
;
pstate
->
p_last_resno
=
1
;
...
...
src/backend/postmaster/postmaster.c
View file @
75fee453
...
...
@@ -37,7 +37,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.29
1 2002/11/10 07:25:14
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.29
2 2002/11/11 03:02:19
momjian Exp $
*
* NOTES
*
...
...
@@ -1092,8 +1092,10 @@ ProcessStartupPacket(Port *port, bool SSLdone)
if
(
len
<
sizeof
(
ProtocolVersion
)
||
len
>
sizeof
(
StartupPacket
))
elog
(
FATAL
,
"invalid length of startup packet"
);
buf
=
palloc
(
sizeof
(
StartupPacket
));
/* Ensure we see zeroes for any bytes not sent */
buf
=
palloc0
(
sizeof
(
StartupPacket
));
MemSet
(
buf
,
0
,
sizeof
(
StartupPacket
));
if
(
pq_getbytes
(
buf
,
len
)
==
EOF
)
{
...
...
src/backend/utils/adt/acl.c
View file @
75fee453
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.8
1 2002/11/10 07:25:14
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/acl.c,v 1.8
2 2002/11/11 03:02:19
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -248,7 +248,8 @@ makeacl(int n)
if
(
n
<
0
)
elog
(
ERROR
,
"makeacl: invalid size: %d"
,
n
);
size
=
ACL_N_SIZE
(
n
);
new_acl
=
(
Acl
*
)
palloc0
(
size
);
new_acl
=
(
Acl
*
)
palloc
(
size
);
MemSet
((
char
*
)
new_acl
,
0
,
size
);
new_acl
->
size
=
size
;
new_acl
->
ndim
=
1
;
new_acl
->
flags
=
0
;
...
...
src/backend/utils/adt/arrayfuncs.c
View file @
75fee453
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.8
3 2002/11/10 07:25:14
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.8
4 2002/11/11 03:02:19
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -235,7 +235,8 @@ array_in(PG_FUNCTION_ARGS)
if
(
nitems
==
0
)
{
/* Return empty array */
retval
=
(
ArrayType
*
)
palloc0
(
sizeof
(
ArrayType
));
retval
=
(
ArrayType
*
)
palloc
(
sizeof
(
ArrayType
));
MemSet
(
retval
,
0
,
sizeof
(
ArrayType
));
retval
->
size
=
sizeof
(
ArrayType
);
retval
->
elemtype
=
element_type
;
PG_RETURN_ARRAYTYPE_P
(
retval
);
...
...
@@ -248,7 +249,8 @@ array_in(PG_FUNCTION_ARGS)
typmod
,
typdelim
,
typlen
,
typbyval
,
typalign
,
&
nbytes
);
nbytes
+=
ARR_OVERHEAD
(
ndim
);
retval
=
(
ArrayType
*
)
palloc0
(
nbytes
);
retval
=
(
ArrayType
*
)
palloc
(
nbytes
);
MemSet
(
retval
,
0
,
nbytes
);
retval
->
size
=
nbytes
;
retval
->
ndim
=
ndim
;
retval
->
elemtype
=
element_type
;
...
...
@@ -395,7 +397,8 @@ ReadArrayStr(char *arrayStr,
prod
[
MAXDIM
];
mda_get_prod
(
ndim
,
dim
,
prod
);
values
=
(
Datum
*
)
palloc0
(
nitems
*
sizeof
(
Datum
));
values
=
(
Datum
*
)
palloc
(
nitems
*
sizeof
(
Datum
));
MemSet
(
values
,
0
,
nitems
*
sizeof
(
Datum
));
MemSet
(
indx
,
0
,
sizeof
(
indx
));
/* read array enclosed within {} */
...
...
@@ -511,7 +514,10 @@ ReadArrayStr(char *arrayStr,
if
(
!
typbyval
)
for
(
i
=
0
;
i
<
nitems
;
i
++
)
if
(
values
[
i
]
==
(
Datum
)
0
)
values
[
i
]
=
PointerGetDatum
(
palloc0
(
typlen
));
{
values
[
i
]
=
PointerGetDatum
(
palloc
(
typlen
));
MemSet
(
DatumGetPointer
(
values
[
i
]),
0
,
typlen
);
}
}
else
{
...
...
@@ -1587,7 +1593,8 @@ array_map(FunctionCallInfo fcinfo, Oid inpType, Oid retType)
/* Allocate and initialize the result array */
nbytes
+=
ARR_OVERHEAD
(
ndim
);
result
=
(
ArrayType
*
)
palloc0
(
nbytes
);
result
=
(
ArrayType
*
)
palloc
(
nbytes
);
MemSet
(
result
,
0
,
nbytes
);
result
->
size
=
nbytes
;
result
->
ndim
=
ndim
;
...
...
src/backend/utils/adt/geo_ops.c
View file @
75fee453
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.
69 2002/11/10 07:25:14
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.
70 2002/11/11 03:02:19
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -3130,8 +3130,9 @@ poly_in(PG_FUNCTION_ARGS)
elog
(
ERROR
,
"Bad polygon external representation '%s'"
,
str
);
size
=
offsetof
(
POLYGON
,
p
[
0
])
+
sizeof
(
poly
->
p
[
0
])
*
npts
;
poly
=
(
POLYGON
*
)
palloc
0
(
size
);
/* zero any holes */
poly
=
(
POLYGON
*
)
palloc
(
size
);
MemSet
((
char
*
)
poly
,
0
,
size
);
/* zero any holes */
poly
->
size
=
size
;
poly
->
npts
=
npts
;
...
...
@@ -4451,7 +4452,9 @@ circle_poly(PG_FUNCTION_ARGS)
if
(
base_size
/
npts
!=
sizeof
(
poly
->
p
[
0
])
||
size
<=
base_size
)
elog
(
ERROR
,
"too many points requested"
);
poly
=
(
POLYGON
*
)
palloc0
(
size
);
/* zero any holes */
poly
=
(
POLYGON
*
)
palloc
(
size
);
MemSet
(
poly
,
0
,
size
);
/* zero any holes */
poly
->
size
=
size
;
poly
->
npts
=
npts
;
...
...
src/backend/utils/adt/network.c
View file @
75fee453
...
...
@@ -3,7 +3,7 @@
* is for IP V4 CIDR notation, but prepared for V6: just
* add the necessary bits where the comments indicate.
*
* $Header: /cvsroot/pgsql/src/backend/utils/adt/network.c,v 1.3
6 2002/11/10 07:25:14
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/network.c,v 1.3
7 2002/11/11 03:02:19
momjian Exp $
*
* Jon Postel RIP 16 Oct 1998
*/
...
...
@@ -51,8 +51,9 @@ network_in(char *src, int type)
int
bits
;
inet
*
dst
;
dst
=
(
inet
*
)
palloc
(
VARHDRSZ
+
sizeof
(
inet_struct
));
/* make sure any unused bits in a CIDR value are zeroed */
dst
=
(
inet
*
)
palloc0
(
VARHDRSZ
+
sizeof
(
inet_struct
));
MemSet
(
dst
,
0
,
VARHDRSZ
+
sizeof
(
inet_struct
));
/* First, try for an IP V4 address: */
ip_family
(
dst
)
=
AF_INET
;
...
...
@@ -493,8 +494,9 @@ network_broadcast(PG_FUNCTION_ARGS)
inet
*
ip
=
PG_GETARG_INET_P
(
0
);
inet
*
dst
;
dst
=
(
inet
*
)
palloc
(
VARHDRSZ
+
sizeof
(
inet_struct
));
/* make sure any unused bits are zeroed */
dst
=
(
inet
*
)
palloc0
(
VARHDRSZ
+
sizeof
(
inet_struct
));
MemSet
(
dst
,
0
,
VARHDRSZ
+
sizeof
(
inet_struct
));
if
(
ip_family
(
ip
)
==
AF_INET
)
{
...
...
@@ -532,8 +534,9 @@ network_network(PG_FUNCTION_ARGS)
inet
*
ip
=
PG_GETARG_INET_P
(
0
);
inet
*
dst
;
dst
=
(
inet
*
)
palloc
(
VARHDRSZ
+
sizeof
(
inet_struct
));
/* make sure any unused bits are zeroed */
dst
=
(
inet
*
)
palloc0
(
VARHDRSZ
+
sizeof
(
inet_struct
));
MemSet
(
dst
,
0
,
VARHDRSZ
+
sizeof
(
inet_struct
));
if
(
ip_family
(
ip
)
==
AF_INET
)
{
...
...
@@ -571,8 +574,9 @@ network_netmask(PG_FUNCTION_ARGS)
inet
*
ip
=
PG_GETARG_INET_P
(
0
);
inet
*
dst
;
dst
=
(
inet
*
)
palloc
(
VARHDRSZ
+
sizeof
(
inet_struct
));
/* make sure any unused bits are zeroed */
dst
=
(
inet
*
)
palloc0
(
VARHDRSZ
+
sizeof
(
inet_struct
));
MemSet
(
dst
,
0
,
VARHDRSZ
+
sizeof
(
inet_struct
));
if
(
ip_family
(
ip
)
==
AF_INET
)
{
...
...
src/backend/utils/adt/varbit.c
View file @
75fee453
...
...
@@ -9,7 +9,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varbit.c,v 1.2
7 2002/11/10 07:25:14
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varbit.c,v 1.2
8 2002/11/11 03:02:19
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -107,8 +107,9 @@ bit_in(PG_FUNCTION_ARGS)
bitlen
,
atttypmod
);
len
=
VARBITTOTALLEN
(
atttypmod
);
result
=
(
VarBit
*
)
palloc
(
len
);
/* set to 0 so that *r is always initialised and string is zero-padded */
result
=
(
VarBit
*
)
palloc0
(
len
);
MemSet
(
result
,
0
,
len
);
VARATT_SIZEP
(
result
)
=
len
;
VARBITLEN
(
result
)
=
atttypmod
;
...
...
@@ -231,8 +232,9 @@ bit(PG_FUNCTION_ARGS)
VARBITLEN
(
arg
),
len
);
rlen
=
VARBITTOTALLEN
(
len
);
result
=
(
VarBit
*
)
palloc
(
rlen
);
/* set to 0 so that string is zero-padded */
result
=
(
VarBit
*
)
palloc0
(
rlen
);
MemSet
(
result
,
0
,
rlen
);
VARATT_SIZEP
(
result
)
=
rlen
;
VARBITLEN
(
result
)
=
len
;
...
...
@@ -314,8 +316,9 @@ varbit_in(PG_FUNCTION_ARGS)
atttypmod
);
len
=
VARBITTOTALLEN
(
bitlen
);
result
=
(
VarBit
*
)
palloc
(
len
);
/* set to 0 so that *r is always initialised and string is zero-padded */
result
=
(
VarBit
*
)
palloc0
(
len
);
MemSet
(
result
,
0
,
len
);
VARATT_SIZEP
(
result
)
=
len
;
VARBITLEN
(
result
)
=
Min
(
bitlen
,
atttypmod
);
...
...
src/backend/utils/cache/catcache.c
View file @
75fee453
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.10
0 2002/11/10 07:25:14
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.10
1 2002/11/11 03:02:19
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -808,7 +808,8 @@ InitCatCache(int id,
*
* Note: we assume zeroing initializes the Dllist headers correctly
*/
cp
=
(
CatCache
*
)
palloc0
(
sizeof
(
CatCache
)
+
NCCBUCKETS
*
sizeof
(
Dllist
));
cp
=
(
CatCache
*
)
palloc
(
sizeof
(
CatCache
)
+
NCCBUCKETS
*
sizeof
(
Dllist
));
MemSet
((
char
*
)
cp
,
0
,
sizeof
(
CatCache
)
+
NCCBUCKETS
*
sizeof
(
Dllist
));
/*
* initialize the cache's relation information for the relation
...
...
src/backend/utils/cache/relcache.c
View file @
75fee453
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.17
8 2002/11/10 07:25:14
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.17
9 2002/11/11 03:02:19
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1348,9 +1348,13 @@ formrdesc(const char *relationName,
/*
* allocate new relation desc
*/
relation
=
(
Relation
)
palloc
(
sizeof
(
RelationData
));
/*
* clear all fields of reldesc
*/
relation
=
(
Relation
)
palloc0
(
sizeof
(
RelationData
));
MemSet
((
char
*
)
relation
,
0
,
sizeof
(
RelationData
));
relation
->
rd_targblock
=
InvalidBlockNumber
;
/* make sure relation is marked as having no open file yet */
...
...
@@ -1376,7 +1380,8 @@ formrdesc(const char *relationName,
* get us launched. RelationCacheInitializePhase2() will read the
* real data from pg_class and replace what we've done here.
*/
relation
->
rd_rel
=
(
Form_pg_class
)
palloc0
(
CLASS_TUPLE_SIZE
);
relation
->
rd_rel
=
(
Form_pg_class
)
palloc
(
CLASS_TUPLE_SIZE
);
MemSet
(
relation
->
rd_rel
,
0
,
CLASS_TUPLE_SIZE
);
namestrcpy
(
&
relation
->
rd_rel
->
relname
,
relationName
);
relation
->
rd_rel
->
relnamespace
=
PG_CATALOG_NAMESPACE
;
...
...
@@ -2049,7 +2054,8 @@ RelationBuildLocalRelation(const char *relname,
/*
* allocate a new relation descriptor and fill in basic state fields.
*/
rel
=
(
Relation
)
palloc0
(
sizeof
(
RelationData
));
rel
=
(
Relation
)
palloc
(
sizeof
(
RelationData
));
MemSet
((
char
*
)
rel
,
0
,
sizeof
(
RelationData
));
rel
->
rd_targblock
=
InvalidBlockNumber
;
...
...
@@ -2087,7 +2093,8 @@ RelationBuildLocalRelation(const char *relname,
/*
* initialize relation tuple form (caller may add/override data later)
*/
rel
->
rd_rel
=
(
Form_pg_class
)
palloc0
(
CLASS_TUPLE_SIZE
);
rel
->
rd_rel
=
(
Form_pg_class
)
palloc
(
CLASS_TUPLE_SIZE
);
MemSet
((
char
*
)
rel
->
rd_rel
,
0
,
CLASS_TUPLE_SIZE
);
namestrcpy
(
&
rel
->
rd_rel
->
relname
,
relname
);
rel
->
rd_rel
->
relnamespace
=
relnamespace
;
...
...
src/backend/utils/fmgr/fmgr.c
View file @
75fee453
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.6
4 2002/11/10 07:25:14
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.6
5 2002/11/11 03:02:19
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1550,8 +1550,9 @@ Int64GetDatum(int64 X)
* with zeroes in the unused bits. This is needed so that, for
* example, hash join of int8 will behave properly.
*/
int64
*
retval
=
(
int64
*
)
palloc
0
(
Max
(
sizeof
(
int64
),
8
));
int64
*
retval
=
(
int64
*
)
palloc
(
Max
(
sizeof
(
int64
),
8
));
MemSet
(
retval
,
0
,
Max
(
sizeof
(
int64
),
8
));
*
retval
=
X
;
return
PointerGetDatum
(
retval
);
#endif
/* INT64_IS_BUSTED */
...
...
src/backend/utils/sort/tuplesort.c
View file @
75fee453
...
...
@@ -78,7 +78,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.3
0 2002/11/10 07:25:14
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplesort.c,v 1.3
1 2002/11/11 03:02:19
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -414,7 +414,9 @@ tuplesort_begin_common(bool randomAccess)
{
Tuplesortstate
*
state
;
state
=
(
Tuplesortstate
*
)
palloc0
(
sizeof
(
Tuplesortstate
));
state
=
(
Tuplesortstate
*
)
palloc
(
sizeof
(
Tuplesortstate
));
MemSet
((
char
*
)
state
,
0
,
sizeof
(
Tuplesortstate
));
state
->
status
=
TSS_INITIAL
;
state
->
randomAccess
=
randomAccess
;
...
...
@@ -457,9 +459,11 @@ tuplesort_begin_heap(TupleDesc tupDesc,
state
->
tupDesc
=
tupDesc
;
state
->
nKeys
=
nkeys
;
state
->
scanKeys
=
(
ScanKey
)
palloc0
(
nkeys
*
sizeof
(
ScanKeyData
));
state
->
scanKeys
=
(
ScanKey
)
palloc
(
nkeys
*
sizeof
(
ScanKeyData
));
MemSet
(
state
->
scanKeys
,
0
,
nkeys
*
sizeof
(
ScanKeyData
));
state
->
sortFnKinds
=
(
SortFunctionKind
*
)
palloc0
(
nkeys
*
sizeof
(
SortFunctionKind
));
palloc
(
nkeys
*
sizeof
(
SortFunctionKind
));
MemSet
(
state
->
sortFnKinds
,
0
,
nkeys
*
sizeof
(
SortFunctionKind
));
for
(
i
=
0
;
i
<
nkeys
;
i
++
)
{
...
...
src/backend/utils/sort/tuplestore.c
View file @
75fee453
...
...
@@ -26,7 +26,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplestore.c,v 1.
8 2002/11/10 07:25:14
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/sort/tuplestore.c,v 1.
9 2002/11/11 03:02:19
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -197,7 +197,9 @@ tuplestore_begin_common(bool randomAccess, int maxKBytes)
{
Tuplestorestate
*
state
;
state
=
(
Tuplestorestate
*
)
palloc0
(
sizeof
(
Tuplestorestate
));
state
=
(
Tuplestorestate
*
)
palloc
(
sizeof
(
Tuplestorestate
));
MemSet
((
char
*
)
state
,
0
,
sizeof
(
Tuplestorestate
));
state
->
status
=
TSS_INITIAL
;
state
->
randomAccess
=
randomAccess
;
...
...
src/include/c.h
View file @
75fee453
...
...
@@ -12,7 +12,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: c.h,v 1.13
0 2002/10/24 03:11:05
momjian Exp $
* $Id: c.h,v 1.13
1 2002/11/11 03:02:19
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -586,8 +586,7 @@ typedef NameData *Name;
int _val = (val); \
Size _len = (len); \
\
if ((((long) _start) & INT_ALIGN_MASK) == 0 && \
(_len & INT_ALIGN_MASK) == 0 && \
if ((( ((long) _start) | _len) & INT_ALIGN_MASK) == 0 && \
_val == 0 && \
_len <= MEMSET_LOOP_LIMIT) \
{ \
...
...
src/pl/plpgsql/src/pl_exec.c
View file @
75fee453
...
...
@@ -3,7 +3,7 @@
* procedural language
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.6
7 2002/11/10 07:25:14
momjian Exp $
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.6
8 2002/11/11 03:02:19
momjian Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
...
...
@@ -1008,7 +1008,7 @@ exec_stmt_perform(PLpgSQL_execstate * estate, PLpgSQL_stmt_perform * stmt)
*/
if
(
expr
->
plan
==
NULL
)
exec_prepare_plan
(
estate
,
expr
);
rc
=
exec_run_select
(
estate
,
expr
,
0
,
NULL
);
if
(
rc
!=
SPI_OK_SELECT
)
elog
(
ERROR
,
"query
\"
%s
\"
didn't return data"
,
expr
->
query
);
...
...
@@ -1627,8 +1627,9 @@ exec_stmt_return_next(PLpgSQL_execstate * estate,
if
(
natts
!=
stmt
->
row
->
nfields
)
elog
(
ERROR
,
"Wrong record type supplied in RETURN NEXT"
);
dvalues
=
(
Datum
*
)
palloc
0
(
natts
*
sizeof
(
Datum
));
dvalues
=
(
Datum
*
)
palloc
(
natts
*
sizeof
(
Datum
));
nulls
=
(
char
*
)
palloc
(
natts
*
sizeof
(
char
));
MemSet
(
dvalues
,
0
,
natts
*
sizeof
(
Datum
));
MemSet
(
nulls
,
'n'
,
natts
);
for
(
i
=
0
;
i
<
natts
;
i
++
)
...
...
src/test/regress/regress.c
View file @
75fee453
/*
* $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.5
2 2002/11/10 07:25:14
momjian Exp $
* $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.5
3 2002/11/11 03:02:20
momjian Exp $
*/
#include "postgres.h"
...
...
@@ -300,11 +300,12 @@ reverse_name(char *string)
int
len
;
char
*
new_string
;
if
(
!
(
new_string
=
palloc
0
(
NAMEDATALEN
)))
if
(
!
(
new_string
=
palloc
(
NAMEDATALEN
)))
{
fprintf
(
stderr
,
"reverse_name: palloc failed
\n
"
);
return
NULL
;
}
MemSet
(
new_string
,
0
,
NAMEDATALEN
);
for
(
i
=
0
;
i
<
NAMEDATALEN
&&
string
[
i
];
++
i
)
;
if
(
i
==
NAMEDATALEN
||
!
string
[
i
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment