Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite9ad14f

Browse files
committed
Use NAMEDATALEN instead of local define.
Modify path separators for Win32.Per ideas from Takahiro Itagaki
1 parent36d3afd commite9ad14f

File tree

5 files changed

+18
-24
lines changed

5 files changed

+18
-24
lines changed

‎contrib/pg_upgrade/exec.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ check_exec(migratorContext *ctx, const char *dir, const char *cmdName)
138138
charpath[MAXPGPATH];
139139
constchar*errMsg;
140140

141-
snprintf(path,sizeof(path),"%s%c%s",dir,pathSeparator,cmdName);
141+
snprintf(path,sizeof(path),"%s/%s",dir,cmdName);
142142

143143
if ((errMsg=validate_exec(path))==NULL)
144144
return1;/* 1 -> first alternative OK */
@@ -286,8 +286,8 @@ check_data_dir(migratorContext *ctx, const char *pg_data)
286286
{
287287
structstatstatBuf;
288288

289-
snprintf(subDirName,sizeof(subDirName),"%s%c%s",pg_data,
290-
pathSeparator,requiredSubdirs[subdirnum]);
289+
snprintf(subDirName,sizeof(subDirName),"%s/%s",pg_data,
290+
requiredSubdirs[subdirnum]);
291291

292292
if ((stat(subDirName,&statBuf))!=0)
293293
{

‎contrib/pg_upgrade/file.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@
1313
#include<windows.h>
1414
#endif
1515

16-
#ifndefWIN32
17-
charpathSeparator='/';
18-
#else
19-
charpathSeparator='\\';
20-
#endif
21-
2216

2317
staticintcopy_file(constchar*fromfile,constchar*tofile,boolforce);
2418

‎contrib/pg_upgrade/option.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,13 @@ validateDirectoryOption(migratorContext *ctx, char **dirpath,
308308
/*
309309
* Trim off any trailing path separators
310310
*/
311-
if ((*dirpath)[strlen(*dirpath)-1]==pathSeparator)
311+
#ifndefWIN32
312+
if ((*dirpath)[strlen(*dirpath)-1]=='/')
313+
#else
314+
if ((*dirpath)[strlen(*dirpath)-1]=='/'||
315+
(*dirpath)[strlen(*dirpath)-1]=='\\')
316+
#endif
312317
(*dirpath)[strlen(*dirpath)-1]=0;
313-
314318
}
315319

316320

‎contrib/pg_upgrade/pg_upgrade.h

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
#include"libpq-fe.h"
1717

1818
/* Allocate for null byte */
19-
#defineNAMEDATASIZE(NAMEDATALEN + 1)
20-
2119
#defineUSER_NAME_SIZE128
2220

2321
#defineMAX_STRING1024
@@ -73,15 +71,13 @@ extern int pgunlink(const char *path);
7371
externvoidcopydir(char*fromdir,char*todir,boolrecurse);
7472
externboolrmtree(constchar*path,boolrmtopdir);
7573

76-
externcharpathSeparator;
77-
7874
/*
7975
* Each relation is represented by a relinfo structure.
8076
*/
8177
typedefstruct
8278
{
83-
charnspname[NAMEDATASIZE];/* namespace name */
84-
charrelname[NAMEDATASIZE];/* relation name */
79+
charnspname[NAMEDATALEN];/* namespace name */
80+
charrelname[NAMEDATALEN];/* relation name */
8581
Oidreloid;/* relation oid */
8682
Oidrelfilenode;/* relation relfile node */
8783
Oidtoastrelid;/* oid of the toast relation */
@@ -103,10 +99,10 @@ typedef struct
10399
Oidnew;/* Relfilenode of the new relation */
104100
charold_file[MAXPGPATH];
105101
charnew_file[MAXPGPATH];
106-
charold_nspname[NAMEDATASIZE];/* old name of the namespace */
107-
charold_relname[NAMEDATASIZE];/* old name of the relation */
108-
charnew_nspname[NAMEDATASIZE];/* new name of the namespace */
109-
charnew_relname[NAMEDATASIZE];/* new name of the relation */
102+
charold_nspname[NAMEDATALEN];/* old name of the namespace */
103+
charold_relname[NAMEDATALEN];/* old name of the relation */
104+
charnew_nspname[NAMEDATALEN];/* new name of the namespace */
105+
charnew_relname[NAMEDATALEN];/* new name of the relation */
110106
}FileNameMap;
111107

112108
/*
@@ -115,7 +111,7 @@ typedef struct
115111
typedefstruct
116112
{
117113
Oiddb_oid;/* oid of the database */
118-
chardb_name[NAMEDATASIZE];/* database name */
114+
chardb_name[NAMEDATALEN];/* database name */
119115
chardb_tblspace[MAXPGPATH];/* database default tablespace path */
120116
RelInfoArrrel_arr;/* array of all user relinfos */
121117
}DbInfo;

‎contrib/pg_upgrade/version_old_8_3.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ old_8_3_rebuild_tsvector_tables(migratorContext *ctx, bool check_mode,
318318
{
319319
PGresult*res;
320320
booldb_used= false;
321-
charold_nspname[NAMEDATASIZE]="",
322-
old_relname[NAMEDATASIZE]="";
321+
charold_nspname[NAMEDATALEN]="",
322+
old_relname[NAMEDATALEN]="";
323323
intntups;
324324
introwno;
325325
inti_nspname,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp