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
35b0a6b2
Commit
35b0a6b2
authored
Feb 03, 2011
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify code used in is_absolute_path() macro; also add comment about
'E:abc' Win32 path handling.
parent
76129e7f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
10 deletions
+14
-10
src/include/port.h
src/include/port.h
+14
-4
src/port/path.c
src/port/path.c
+0
-6
No files found.
src/include/port.h
View file @
35b0a6b2
...
...
@@ -68,17 +68,27 @@ extern void pgfnames_cleanup(char **filenames);
* By making this a macro we avoid needing to include path.c in libpq.
*/
#ifndef WIN32
#define IS_DIR_SEP(ch) ((ch) == '/')
#define is_absolute_path(filename) \
( \
((filename)[0] == '/'
) \
IS_DIR_SEP((filename)[0]
) \
)
#else
#define IS_DIR_SEP(ch) ((ch) == '/' || (ch) == '\\')
/*
* On Win32, a drive letter _not_ followed by a slash, e.g. 'E:abc', is
* relative to the cwd on that drive, or the drive's root directory
* if that drive has no cwd. Because the path itself cannot tell us
* which is the case, we have to assume the worst, i.e. that it is not
* absolute; this check is done by IS_DIR_SEP(filename[2]).
*/
#define is_absolute_path(filename) \
( \
((filename)[0] == '/') || \
(filename)[0] == '\\' || \
IS_DIR_SEP((filename)[0]) || \
(isalpha((unsigned char) ((filename)[0])) && (filename)[1] == ':' && \
((filename)[2] == '\\' || (filename)[2] == '/'
)) \
IS_DIR_SEP((filename)[2]
)) \
)
#endif
...
...
src/port/path.c
View file @
35b0a6b2
...
...
@@ -34,12 +34,6 @@
#include "pg_config_paths.h"
#ifndef WIN32
#define IS_DIR_SEP(ch) ((ch) == '/')
#else
#define IS_DIR_SEP(ch) ((ch) == '/' || (ch) == '\\')
#endif
#ifndef WIN32
#define IS_PATH_VAR_SEP(ch) ((ch) == ':')
#else
...
...
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