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
f3af1368
Commit
f3af1368
authored
Oct 25, 1997
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename strNcpy to StrNCpy, and change third parameter.
parent
8b53f6e5
Changes
31
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
87 additions
and
83 deletions
+87
-83
src/backend/access/common/tupdesc.c
src/backend/access/common/tupdesc.c
+2
-2
src/backend/commands/async.c
src/backend/commands/async.c
+2
-2
src/backend/commands/creatinh.c
src/backend/commands/creatinh.c
+2
-2
src/backend/commands/recipe.c
src/backend/commands/recipe.c
+2
-2
src/backend/executor/execMain.c
src/backend/executor/execMain.c
+3
-3
src/backend/executor/execUtils.c
src/backend/executor/execUtils.c
+2
-2
src/backend/libpq/be-fsstubs.c
src/backend/libpq/be-fsstubs.c
+3
-3
src/backend/libpq/be-pqexec.c
src/backend/libpq/be-pqexec.c
+2
-2
src/backend/libpq/password.c
src/backend/libpq/password.c
+1
-1
src/backend/libpq/portal.c
src/backend/libpq/portal.c
+3
-3
src/backend/libpq/portalbuf.c
src/backend/libpq/portalbuf.c
+2
-2
src/backend/nodes/print.c
src/backend/nodes/print.c
+4
-4
src/backend/nodes/readfuncs.c
src/backend/nodes/readfuncs.c
+4
-4
src/backend/parser/analyze.c
src/backend/parser/analyze.c
+2
-2
src/backend/parser/gram.y
src/backend/parser/gram.y
+3
-3
src/backend/port/aix/dlfcn.c
src/backend/port/aix/dlfcn.c
+1
-1
src/backend/postmaster/postmaster.c
src/backend/postmaster/postmaster.c
+5
-5
src/backend/storage/smgr/md.c
src/backend/storage/smgr/md.c
+2
-2
src/backend/tcop/postgres.c
src/backend/tcop/postgres.c
+3
-3
src/backend/tcop/variable.c
src/backend/tcop/variable.c
+3
-3
src/backend/tioga/tgRecipe.c
src/backend/tioga/tgRecipe.c
+2
-2
src/backend/utils/adt/char.c
src/backend/utils/adt/char.c
+5
-5
src/backend/utils/adt/filename.c
src/backend/utils/adt/filename.c
+4
-4
src/backend/utils/adt/like.c
src/backend/utils/adt/like.c
+2
-2
src/backend/utils/adt/name.c
src/backend/utils/adt/name.c
+3
-3
src/backend/utils/adt/oidname.c
src/backend/utils/adt/oidname.c
+2
-2
src/backend/utils/adt/regexp.c
src/backend/utils/adt/regexp.c
+2
-2
src/backend/utils/adt/regproc.c
src/backend/utils/adt/regproc.c
+2
-2
src/backend/utils/adt/varchar.c
src/backend/utils/adt/varchar.c
+4
-4
src/backend/utils/sort/psort.c
src/backend/utils/sort/psort.c
+2
-2
src/include/c.h
src/include/c.h
+8
-4
No files found.
src/backend/access/common/tupdesc.c
View file @
f3af1368
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.2
6 1997/09/18 20:19:38
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/tupdesc.c,v 1.2
7 1997/10/25 01:08:45
momjian Exp $
*
* NOTES
* some of the executor utility code such as "ExecTypeFromTL" should be
...
...
@@ -489,7 +489,7 @@ BuildDescForRelation(List *schema, char *relname)
}
else
{
strNcpy
(
typename
,
entry
->
typename
->
name
,
NAMEDATALEN
-
1
);
StrNCpy
(
typename
,
entry
->
typename
->
name
,
NAMEDATALEN
);
attdim
=
0
;
}
...
...
src/backend/commands/async.c
View file @
f3af1368
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.2
0 1997/09/12 04:07:20
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.2
1 1997/10/25 01:08:49
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -488,7 +488,7 @@ Async_Listen(char *relname, int pid)
* unlisten prior to dying.
*/
relnamei
=
malloc
(
NAMEDATALEN
);
/* persists to process exit */
strNcpy
(
relnamei
,
relname
,
NAMEDATALEN
-
1
);
StrNCpy
(
relnamei
,
relname
,
NAMEDATALEN
);
on_exitpg
(
Async_UnlistenOnExit
,
(
caddr_t
)
relnamei
);
}
...
...
src/backend/commands/creatinh.c
View file @
f3af1368
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.1
7 1997/09/08 21:42:33
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/creatinh.c,v 1.1
8 1997/10/25 01:08:51
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -65,7 +65,7 @@ DefineRelation(CreateStmt *stmt)
if
(
strlen
(
stmt
->
relname
)
>=
NAMEDATALEN
)
elog
(
WARN
,
"the relation name %s is >= %d characters long"
,
stmt
->
relname
,
NAMEDATALEN
);
strNcpy
(
relname
,
stmt
->
relname
,
NAMEDATALEN
-
1
);
/* make full length for
StrNCpy
(
relname
,
stmt
->
relname
,
NAMEDATALEN
);
/* make full length for
* copy */
/* ----------------
...
...
src/backend/commands/recipe.c
View file @
f3af1368
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.
9 1997/09/08 21:42:42
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.
10 1997/10/25 01:08:54
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1344,7 +1344,7 @@ replaceTeeScans(Plan *plan, Query *parsetree, TeeInfo * teeInfo)
if
((
strlen
(
rte
->
refname
)
<
4
)
||
(
strcmp
(
rte
->
relname
,
rte
->
refname
)
!=
0
))
continue
;
strNcpy
(
prefix
,
rte
->
refname
,
4
);
StrNCpy
(
prefix
,
rte
->
refname
,
5
);
if
(
strcmp
(
prefix
,
"tee_"
)
==
0
)
{
/* okay, we found a tee node entry in the range table */
...
...
src/backend/executor/execMain.c
View file @
f3af1368
...
...
@@ -26,7 +26,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.2
7 1997/10/12 07:09:02 vadim
Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.2
8 1997/10/25 01:09:01 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -330,9 +330,9 @@ ExecCheckPerms(CmdType operation,
if
(
!
HeapTupleIsValid
(
htp
))
elog
(
WARN
,
"ExecCheckPerms: bogus RT relid: %d"
,
relid
);
strNc
py
(
rname
.
data
,
StrNC
py
(
rname
.
data
,
((
Form_pg_class
)
GETSTRUCT
(
htp
))
->
relname
.
data
,
NAMEDATALEN
-
1
);
NAMEDATALEN
);
if
(
i
==
resultRelation
)
{
/* this is the result relation */
qvars
=
pull_varnos
(
parseTree
->
qual
);
...
...
src/backend/executor/execUtils.c
View file @
f3af1368
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.
19 1997/09/18 20:20:35
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.
20 1997/10/25 01:09:10
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -514,7 +514,7 @@ ExecSetTypeInfo(int index,
att
->
attrelid
=
0
;
/* dummy value */
if
(
attName
!=
(
char
*
)
NULL
)
strNcpy
(
att
->
attname
.
data
,
attName
,
NAMEDATALEN
-
1
);
StrNCpy
(
att
->
attname
.
data
,
attName
,
NAMEDATALEN
);
else
MemSet
(
att
->
attname
.
data
,
0
,
NAMEDATALEN
);
...
...
src/backend/libpq/be-fsstubs.c
View file @
f3af1368
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.1
5 1997/09/08 21:43:41
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/be-fsstubs.c,v 1.1
6 1997/10/25 01:09:16
momjian Exp $
*
* NOTES
* This should be moved to a more appropriate place. It is here
...
...
@@ -269,7 +269,7 @@ lo_import(text *filename)
/*
* open the file to be read in
*/
strNcpy
(
fnamebuf
,
VARDATA
(
filename
),
VARSIZE
(
filename
)
-
VARHDRSZ
);
StrNCpy
(
fnamebuf
,
VARDATA
(
filename
),
VARSIZE
(
filename
)
-
VARHDRSZ
+
1
);
fd
=
open
(
fnamebuf
,
O_RDONLY
,
0666
);
if
(
fd
<
0
)
{
/* error */
...
...
@@ -343,7 +343,7 @@ lo_export(Oid lobjId, text *filename)
* open the file to be written to
*/
oumask
=
umask
((
mode_t
)
0
);
strNcpy
(
fnamebuf
,
VARDATA
(
filename
),
VARSIZE
(
filename
)
-
VARHDRSZ
);
StrNCpy
(
fnamebuf
,
VARDATA
(
filename
),
VARSIZE
(
filename
)
-
VARHDRSZ
+
1
);
fd
=
open
(
fnamebuf
,
O_CREAT
|
O_WRONLY
,
0666
);
umask
(
oumask
);
if
(
fd
<
0
)
...
...
src/backend/libpq/be-pqexec.c
View file @
f3af1368
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.
7 1997/09/08 21:43:43
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.
8 1997/10/25 01:09:18
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -241,7 +241,7 @@ strmake(char *str, int len)
len
=
strlen
(
str
);
newstr
=
(
char
*
)
palloc
((
unsigned
)
len
+
1
);
strNcpy
(
newstr
,
str
,
len
);
StrNCpy
(
newstr
,
str
,
len
+
1
);
newstr
[
len
]
=
(
char
)
0
;
return
newstr
;
}
...
...
src/backend/libpq/password.c
View file @
f3af1368
...
...
@@ -90,7 +90,7 @@ verify_password(char *user, char *password, Port *port,
if
(
test_pw
[
strlen
(
test_pw
)
-
1
]
==
'\n'
)
test_pw
[
strlen
(
test_pw
)
-
1
]
=
'\0'
;
strNcpy
(
salt
,
test_pw
,
2
);
StrNCpy
(
salt
,
test_pw
,
3
);
if
(
strcmp
(
user
,
test_user
)
==
0
)
{
...
...
src/backend/libpq/portal.c
View file @
f3af1368
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.
9 1997/09/08 21:43:47
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portal.c,v 1.
10 1997/10/25 01:09:21
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -154,7 +154,7 @@ PQpnames(char **pnames, int rule_p)
{
if
(
!
rule_p
||
portals
[
i
]
->
portal
->
rule_p
)
{
strncpy
(
pnames
[
cur_pname
],
portals
[
i
]
->
name
,
PortalNameLength
);
strncpy
(
pnames
[
cur_pname
],
portals
[
i
]
->
name
,
PortalNameLength
+
1
);
++
cur_pname
;
}
}
...
...
@@ -730,7 +730,7 @@ PQappendNotify(char *relname, int pid)
pqNotifyList
=
DLNewList
();
p
=
(
PQNotifyList
*
)
pbuf_alloc
(
sizeof
(
PQNotifyList
));
strNcpy
(
p
->
relname
,
relname
,
NAMEDATALEN
-
1
);
StrNCpy
(
p
->
relname
,
relname
,
NAMEDATALEN
);
p
->
be_pid
=
pid
;
p
->
valid
=
1
;
DLAddTail
(
pqNotifyList
,
DLNewElem
(
p
));
...
...
src/backend/libpq/portalbuf.c
View file @
f3af1368
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portalbuf.c,v 1.
7 1997/09/08 21:43:48
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/libpq/Attic/portalbuf.c,v 1.
8 1997/10/25 01:09:23
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -384,7 +384,7 @@ void
pbuf_setportalinfo
(
PortalEntry
*
entry
,
char
*
pname
)
{
if
(
entry
)
strNcpy
(
entry
->
name
,
pname
,
PortalNameLength
-
1
);
StrNCpy
(
entry
->
name
,
pname
,
PortalNameLength
);
}
/* --------------------------------
...
...
src/backend/nodes/print.c
View file @
f3af1368
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.
9 1997/09/08 21:44:10
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.
10 1997/10/25 01:09:28
momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
...
...
@@ -391,14 +391,14 @@ print_plan_recursive(Plan *p, Query *parsetree, int indentLevel, char *label)
RangeTblEntry
*
rte
;
rte
=
rt_fetch
(((
Scan
*
)
p
)
->
scanrelid
,
parsetree
->
rtable
);
strNcpy
(
extraInfo
,
rte
->
relname
,
NAMEDATALEN
-
1
);
StrNCpy
(
extraInfo
,
rte
->
relname
,
NAMEDATALEN
);
}
else
if
(
IsA
(
p
,
IndexScan
))
{
strNc
py
(
extraInfo
,
StrNC
py
(
extraInfo
,
((
RangeTblEntry
*
)
(
nth
(((
IndexScan
*
)
p
)
->
scan
.
scanrelid
-
1
,
parsetree
->
rtable
)))
->
relname
,
NAMEDATALEN
-
1
);
NAMEDATALEN
);
}
else
extraInfo
[
0
]
=
'\0'
;
...
...
src/backend/nodes/readfuncs.c
View file @
f3af1368
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.
9 1997/09/08 21:44:11
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.
10 1997/10/25 01:09:30
momjian Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
...
...
@@ -92,7 +92,7 @@ _readQuery()
NotifyStmt
*
n
=
makeNode
(
NotifyStmt
);
n
->
relname
=
palloc
(
length
+
1
);
strNcpy
(
n
->
relname
,
token
,
length
);
StrNCpy
(
n
->
relname
,
token
,
length
+
1
);
local_node
->
utilityStmt
=
(
Node
*
)
n
;
}
...
...
@@ -111,7 +111,7 @@ _readQuery()
else
{
local_node
->
uniqueFlag
=
palloc
(
length
+
1
);
strNcpy
(
local_node
->
uniqueFlag
,
token
,
length
);
StrNCpy
(
local_node
->
uniqueFlag
,
token
,
length
+
1
);
}
token
=
lsptok
(
NULL
,
&
length
);
/* skip :targetlist */
...
...
@@ -1067,7 +1067,7 @@ _readAggreg()
token
=
lsptok
(
NULL
,
&
length
);
/* eat :aggname */
token
=
lsptok
(
NULL
,
&
length
);
/* get aggname */
local_node
->
aggname
=
(
char
*
)
palloc
(
length
+
1
);
strNcpy
(
local_node
->
aggname
,
token
,
length
);
StrNCpy
(
local_node
->
aggname
,
token
,
length
+
1
);
token
=
lsptok
(
NULL
,
&
length
);
/* eat :basetype */
token
=
lsptok
(
NULL
,
&
length
);
/* get basetype */
...
...
src/backend/parser/analyze.c
View file @
f3af1368
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.4
6 1997/10/16 06:58:38 vadim
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.4
7 1997/10/25 01:09:35 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1150,7 +1150,7 @@ makeTargetNames(ParseState *pstate, List *cols)
Ident
*
id
=
makeNode
(
Ident
);
id
->
name
=
palloc
(
NAMEDATALEN
);
strNcpy
(
id
->
name
,
attr
[
i
]
->
attname
.
data
,
NAMEDATALEN
-
1
);
StrNCpy
(
id
->
name
,
attr
[
i
]
->
attname
.
data
,
NAMEDATALEN
);
id
->
indirection
=
NIL
;
id
->
isRel
=
false
;
if
(
tl
==
NIL
)
...
...
src/backend/parser/gram.y
View file @
f3af1368
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.5
6 1997/10/09 05:43:59 thomas
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.5
7 1997/10/25 01:09:41 momjian
Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
...
...
@@ -3117,7 +3117,7 @@ opt_id: Id { $$ = $1; }
relation_name: SpecialRuleRelation
{
$$ = $1;
strNcpy(saved_relname, $1, NAMEDATALEN-1
);
StrNCpy(saved_relname, $1, NAMEDATALEN
);
}
| ColId
{
...
...
@@ -3129,7 +3129,7 @@ relation_name: SpecialRuleRelation
elog(WARN,"%s cannot be accessed by users",$1);
else
$$ = $1;
strNcpy(saved_relname, $1, NAMEDATALEN-1
);
StrNCpy(saved_relname, $1, NAMEDATALEN
);
}
;
...
...
src/backend/port/aix/dlfcn.c
View file @
f3af1368
...
...
@@ -537,7 +537,7 @@ readExports(ModulePtr mp)
* first SYMNMLEN chars and make sure we have a zero byte at
* the end.
*/
strNcpy
(
tmpsym
,
ls
->
l_name
,
SYMNMLEN
);
StrNCpy
(
tmpsym
,
ls
->
l_name
,
SYMNMLEN
+
1
);
symname
=
tmpsym
;
}
ep
->
name
=
strdup
(
symname
);
...
...
src/backend/postmaster/postmaster.c
View file @
f3af1368
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.5
8 1997/09/18 20:21:08
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/postmaster/postmaster.c,v 1.5
9 1997/10/25 01:09:55
momjian Exp $
*
* NOTES
*
...
...
@@ -717,7 +717,7 @@ ConnStartup(Port *port, int *status,
msgType
=
(
MsgType
)
ntohl
(
port
->
buf
.
msgtype
);
strNcpy
(
namebuf
,
sp
.
user
,
NAMEDATALEN
-
1
);
StrNCpy
(
namebuf
,
sp
.
user
,
NAMEDATALEN
);
if
(
!
namebuf
[
0
])
{
strncpy
(
errormsg
,
...
...
@@ -1232,15 +1232,15 @@ DoExec(StartupInfo *packet, int portFd)
sprintf
(
portbuf
,
"-P%d"
,
portFd
);
av
[
ac
++
]
=
portbuf
;
strNc
py
(
argbuf
,
packet
->
options
,
ARGV_SIZE
);
StrNC
py
(
argbuf
,
packet
->
options
,
ARGV_SIZE
);
strncat
(
argbuf
,
ExtraOptions
,
ARGV_SIZE
);
argbuf
[(
2
*
ARGV_SIZE
)]
=
'\0'
;
split_opts
(
av
,
&
ac
,
argbuf
);
if
(
packet
->
database
[
0
])
strNc
py
(
dbbuf
,
packet
->
database
,
ARGV_SIZE
);
StrNC
py
(
dbbuf
,
packet
->
database
,
ARGV_SIZE
);
else
strNcpy
(
dbbuf
,
packet
->
user
,
NAMEDATALEN
-
1
);
StrNCpy
(
dbbuf
,
packet
->
user
,
NAMEDATALEN
);
av
[
ac
++
]
=
dbbuf
;
av
[
ac
]
=
(
char
*
)
NULL
;
...
...
src/backend/storage/smgr/md.c
View file @
f3af1368
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.2
2 1997/09/18 20:21:45
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/smgr/md.c,v 1.2
3 1997/10/25 01:10:04
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -172,7 +172,7 @@ mdunlink(Relation reln)
* do this.
*/
strNcpy
(
fname
,
RelationGetRelationName
(
reln
)
->
data
,
NAMEDATALEN
-
1
);
StrNCpy
(
fname
,
RelationGetRelationName
(
reln
)
->
data
,
NAMEDATALEN
);
if
(
FileNameUnlink
(
fname
)
<
0
)
return
(
SM_FAIL
);
...
...
src/backend/tcop/postgres.c
View file @
f3af1368
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.
49 1997/09/18 20:22:03
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.
50 1997/10/25 01:10:16
momjian Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
...
...
@@ -1088,7 +1088,7 @@ PostgresMain(int argc, char *argv[])
* o - send output (stdout and stderr) to the given file
* ----------------
*/
strNc
py
(
OutputFileName
,
optarg
,
MAXPGPATH
);
StrNC
py
(
OutputFileName
,
optarg
,
MAXPGPATH
);
break
;
case
'p'
:
/* started by postmaster */
...
...
@@ -1391,7 +1391,7 @@ PostgresMain(int argc, char *argv[])
if
(
IsUnderPostmaster
==
false
)
{
puts
(
"
\n
POSTGRES backend interactive interface"
);
puts
(
"$Revision: 1.
49 $ $Date: 1997/09/18 20:22:03
$"
);
puts
(
"$Revision: 1.
50 $ $Date: 1997/10/25 01:10:16
$"
);
}
/* ----------------
...
...
src/backend/tcop/variable.c
View file @
f3af1368
...
...
@@ -2,7 +2,7 @@
* Routines for handling of 'SET var TO', 'SHOW var' and 'RESET var'
* statements.
*
* $Id: variable.c,v 1.1
6 1997/09/08 21:47:59
momjian Exp $
* $Id: variable.c,v 1.1
7 1997/10/25 01:10:22
momjian Exp $
*
*/
...
...
@@ -73,7 +73,7 @@ get_token(char **tok, char **val, const char *str)
}
*
tok
=
(
char
*
)
PALLOC
(
len
+
1
);
strNcpy
(
*
tok
,
start
,
len
);
StrNCpy
(
*
tok
,
start
,
len
+
1
);
/* skip white spaces */
while
(
isspace
(
*
str
))
...
...
@@ -119,7 +119,7 @@ get_token(char **tok, char **val, const char *str)
}
*
val
=
(
char
*
)
PALLOC
(
len
+
1
);
strNcpy
(
*
val
,
start
,
len
);
StrNCpy
(
*
val
,
start
,
len
+
1
);
/* skip white spaces */
while
(
isspace
(
*
str
))
...
...
src/backend/tioga/tgRecipe.c
View file @
f3af1368
...
...
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tioga/Attic/tgRecipe.c,v 1.
6 1997/09/08 21:48:01
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/tioga/Attic/tgRecipe.c,v 1.
7 1997/10/25 01:10:26
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -108,7 +108,7 @@ first character\n", ARRAY_LEFT_DELIM);
* extra character for \0
* anyway */
word
=
(
char
*
)
malloc
(
nextlen
);
strNcpy
(
word
,
beginQuote
+
1
,
nextlen
-
1
);
StrNCpy
(
word
,
beginQuote
+
1
,
nextlen
);
addArr_TgString
(
result
,
(
TgString
*
)
&
word
);
free
(
word
);
str
=
endQuote
+
1
;
...
...
src/backend/utils/adt/char.c
View file @
f3af1368
...
...
@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.1
1 1997/09/08 21:48:18
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.1
2 1997/10/25 01:10:32
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -124,7 +124,7 @@ char16out(char *s)
result
[
1
]
=
'\0'
;
}
else
strNc
py
(
result
,
s
,
16
);
StrNC
py
(
result
,
s
,
16
);
return
(
result
);
}
...
...
@@ -282,7 +282,7 @@ char2out(uint16 s)
{
char
*
result
=
(
char
*
)
palloc
(
3
);
strNcpy
(
result
,
(
char
*
)
&
s
,
2
);
StrNCpy
(
result
,
(
char
*
)
&
s
,
3
);
return
(
result
);
}
...
...
@@ -349,7 +349,7 @@ uint32 s;
{
char
*
result
=
(
char
*
)
palloc
(
5
);
strNcpy
(
result
,
(
char
*
)
&
s
,
4
);
StrNCpy
(
result
,
(
char
*
)
&
s
,
5
);
return
(
result
);
}
...
...
@@ -421,7 +421,7 @@ char8out(char *s)
result
[
1
]
=
'\0'
;
}
else
strNcpy
(
result
,
s
,
8
);
StrNCpy
(
result
,
s
,
9
);
return
(
result
);
}
...
...
src/backend/utils/adt/filename.c
View file @
f3af1368
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/filename.c,v 1.1
0 1997/09/08 02:30:40
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/filename.c,v 1.1
1 1997/10/25 01:10:36
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -59,7 +59,7 @@ filename_in(char *file)
else
{
/* Someone else's directory */
char
name
[
1
6
],
char
name
[
1
7
],
*
p
;
struct
passwd
*
pw
;
int
len
;
...
...
@@ -72,7 +72,7 @@ filename_in(char *file)
else
{
len
=
(
p
-
file
)
-
1
;
strNcpy
(
name
,
file
+
1
,
len
);
StrNCpy
(
name
,
file
+
1
,
len
+
1
);
}
/* printf("name: %s\n"); */
if
((
pw
=
getpwnam
(
name
))
==
NULL
)
...
...
@@ -102,7 +102,7 @@ filename_in(char *file)
else
{
len
=
(
p
-
file
)
-
1
;
strNcpy
(
environment
,
file
+
1
,
len
);
StrNCpy
(
environment
,
file
+
1
,
len
+
1
);
}
envirp
=
getenv
(
environment
);
if
(
envirp
)
...
...
src/backend/utils/adt/like.c
View file @
f3af1368
...
...
@@ -48,7 +48,7 @@ fixedlen_like(char *s, struct varlena * p, int charlen)
/* be sure sterm is null-terminated */
sterm
=
(
char
*
)
palloc
(
charlen
+
1
);
strNcpy
(
sterm
,
s
,
charlen
);
StrNCpy
(
sterm
,
s
,
charlen
+
1
);
/*
* p is a text = varlena, not a string so we have to make a string
...
...
@@ -150,7 +150,7 @@ textnlike(struct varlena * s, struct varlena * p)
}
/* $Revision: 1.
9
$
/* $Revision: 1.
10
$
** "like.c" A first attempt at a LIKE operator for Postgres95.
**
** Originally written by Rich $alz, mirror!rs, Wed Nov 26 19:03:17 EST 1986.
...
...
src/backend/utils/adt/name.c
View file @
f3af1368
...
...
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.
9 1997/09/08 21:48:33
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/name.c,v 1.
10 1997/10/25 01:10:40
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -41,7 +41,7 @@ namein(char *s)
return
(
NULL
);
result
=
(
NameData
*
)
palloc
(
NAMEDATALEN
);
/* always keep it null-padded */
strNcpy
(
result
->
data
,
s
,
NAMEDATALEN
-
1
);
StrNCpy
(
result
->
data
,
s
,
NAMEDATALEN
);
return
(
result
);
}
...
...
@@ -159,7 +159,7 @@ namestrcpy(Name name, char *str)
{
if
(
!
name
||
!
str
)
return
(
-
1
);
strNcpy
(
name
->
data
,
str
,
NAMEDATALEN
-
1
);
StrNCpy
(
name
->
data
,
str
,
NAMEDATALEN
);
return
(
0
);
}
...
...
src/backend/utils/adt/oidname.c
View file @
f3af1368
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidname.c,v 1.
8 1997/09/18 20:22:16
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/oidname.c,v 1.
9 1997/10/25 01:10:41
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -37,7 +37,7 @@ oidnamein(char *inStr)
oc
->
id
=
(
Oid
)
pg_atoi
(
inStr
,
sizeof
(
Oid
),
','
);
/* copy one less to ensure null-padding */
++
inptr
;
strNcpy
(
oc
->
name
.
data
,
inptr
,
NAMEDATALEN
-
1
);
StrNCpy
(
oc
->
name
.
data
,
inptr
,
NAMEDATALEN
);
}
else
elog
(
WARN
,
"Bad input data for type oidname"
);
...
...
src/backend/utils/adt/regexp.c
View file @
f3af1368
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.1
0 1997/09/08 21:48:40
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regexp.c,v 1.1
1 1997/10/25 01:10:44
momjian Exp $
*
* Alistair Crooks added the code for the regex caching
* agc - cached the regular expressions used - there's a good chance
...
...
@@ -189,7 +189,7 @@ fixedlen_regexeq(char *s, struct varlena * p, int charlen, int cflags)
/* be sure sterm is null-terminated */
sterm
=
(
char
*
)
palloc
(
charlen
+
1
);
strNcpy
(
sterm
,
s
,
charlen
);
StrNCpy
(
sterm
,
s
,
charlen
+
1
);
result
=
RE_compile_and_execute
(
p
,
sterm
,
cflags
);
...
...
src/backend/utils/adt/regproc.c
View file @
f3af1368
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.
7 1997/09/08 02:30:58
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.
8 1997/10/25 01:10:45
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -133,7 +133,7 @@ regprocout(RegProcedure proid)
RelationGetTupleDescriptor
(
proc
),
&
isnull
);
if
(
!
isnull
)
{
strNc
py
(
result
,
s
,
16
);
StrNC
py
(
result
,
s
,
16
);
break
;
}
elog
(
FATAL
,
"regprocout: null procedure %d"
,
proid
);
...
...
src/backend/utils/adt/varchar.c
View file @
f3af1368
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.1
0 1997/09/08 02:31:05
momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/varchar.c,v 1.1
1 1997/10/25 01:10:50
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -106,7 +106,7 @@ bpcharout(char *s)
{
len
=
*
(
int32
*
)
s
-
4
;
result
=
(
char
*
)
palloc
(
len
+
1
);
strNcpy
(
result
,
s
+
4
,
len
);
/* these are blank-padded */
StrNCpy
(
result
,
s
+
4
,
len
+
1
);
/* these are blank-padded */
}
return
(
result
);
}
...
...
@@ -145,7 +145,7 @@ varcharin(char *s, int dummy, int typlen)
result
=
(
char
*
)
palloc
(
typlen
);
*
(
int32
*
)
result
=
typlen
;
strncpy
(
result
+
4
,
s
,
len
);
strncpy
(
result
+
4
,
s
,
len
+
1
);
return
(
result
);
}
...
...
@@ -166,7 +166,7 @@ varcharout(char *s)
{
len
=
*
(
int32
*
)
s
-
4
;
result
=
(
char
*
)
palloc
(
len
+
1
);
strNcpy
(
result
,
s
+
4
,
len
);
StrNCpy
(
result
,
s
+
4
,
len
+
1
);
}
return
(
result
);
}
...
...
src/backend/utils/sort/psort.c
View file @
f3af1368
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.2
6 1997/10/15 06:36:08 vadim
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/sort/Attic/psort.c,v 1.2
7 1997/10/25 01:10:52 momjian
Exp $
*
* NOTES
* Sorts the first relation into the second relation.
...
...
@@ -1006,7 +1006,7 @@ gettape()
* now, copy template with final null into palloc'd space
*/
strNcpy
(
tp
->
tl_name
,
uniqueName
,
MAXPGPATH
-
1
);
StrNCpy
(
tp
->
tl_name
,
uniqueName
,
MAXPGPATH
);
file
=
AllocateFile
(
tp
->
tl_name
,
"w+"
);
...
...
src/include/c.h
View file @
f3af1368
...
...
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: c.h,v 1.2
2 1997/09/18 18:48:32
momjian Exp $
* $Id: c.h,v 1.2
3 1997/10/25 01:10:58
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -29,7 +29,7 @@
* 5) IsValid macros for system types
* 6) offsetof, lengthof, endof
* 7) exception handling definitions, Assert, Trap, etc macros
* 8) Min, Max, Abs,
strNc
py macros
* 8) Min, Max, Abs,
StrNC
py macros
* 9) externs
* 10) Berkeley-specific defs
* 11) system-specific hacks
...
...
@@ -686,11 +686,15 @@ typedef struct Exception
#define Abs(x) ((x) >= 0 ? (x) : -(x))
/*
*
strNc
py --
*
StrNC
py --
* Does string copy, and forces terminating NULL
*/
/* we do this so if the macro is used in an if action, it will work */
#define strNcpy(dst,src,len) (strncpy((dst),(src),(len)),*((dst)+(len))='\0')
#define StrNCpy(dst,src,len) do { \
strncpy((dst),(src),(len)); \
if (len > 0) \
*((dst)+(len)-1)='\0'; \
} while (0)
/* Get a bit mask of the bits set in non-int32 aligned addresses */
#define INT_ALIGN_MASK (sizeof(int32) - 1)
...
...
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