summaryrefslogtreecommitdiff
path: root/src/port
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2009-06-11 14:49:15 +0000
committerBruce Momjian <bruce@momjian.us>2009-06-11 14:49:15 +0000
commitd7471402794266078953f1bd113dab4913d631a1 (patch)
tree618e392a84eaf837e00bf78f8694097b78fec227 /src/port
parent4e86efb4e51b66ef57b3fe6f28576de23a1bf1c6 (diff)
downloadpostgresql-d7471402794266078953f1bd113dab4913d631a1.tar.gz
8.4 pgindent run, with new combined Linux/FreeBSD/MinGW typedef list
provided by Andrew.
Diffstat (limited to 'src/port')
-rw-r--r--src/port/crypt.c4
-rw-r--r--src/port/dirmod.c26
-rw-r--r--src/port/exec.c14
-rw-r--r--src/port/getopt.c4
-rw-r--r--src/port/getopt_long.c3
-rw-r--r--src/port/getrusage.c4
-rw-r--r--src/port/open.c29
-rw-r--r--src/port/path.c4
-rw-r--r--src/port/pipe.c10
-rw-r--r--src/port/pthread-win32.h2
-rw-r--r--src/port/rand.c2
-rw-r--r--src/port/strlcat.c2
-rw-r--r--src/port/strtol.c2
-rw-r--r--src/port/strtoul.c2
-rw-r--r--src/port/win32env.c43
15 files changed, 75 insertions, 76 deletions
diff --git a/src/port/crypt.c b/src/port/crypt.c
index 7139ecf3d1..920ab932a5 100644
--- a/src/port/crypt.c
+++ b/src/port/crypt.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/port/crypt.c,v 1.15 2006/03/11 04:38:40 momjian Exp $ */
+/* $PostgreSQL: pgsql/src/port/crypt.c,v 1.16 2009/06/11 14:49:15 momjian Exp $ */
/* $NetBSD: crypt.c,v 1.18 2001/03/01 14:37:35 wiz Exp $ */
/*
@@ -236,7 +236,7 @@ typedef union
#if defined(B64)
B64 b64;
#endif
-} C_block;
+} C_block;
/*
* Convert twenty-four-bit long in host-order
diff --git a/src/port/dirmod.c b/src/port/dirmod.c
index 5bda09b92c..a31e74cbd3 100644
--- a/src/port/dirmod.c
+++ b/src/port/dirmod.c
@@ -10,7 +10,7 @@
* Win32 (NT4 and newer).
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/dirmod.c,v 1.57 2009/05/04 09:30:06 mha Exp $
+ * $PostgreSQL: pgsql/src/port/dirmod.c,v 1.58 2009/06/11 14:49:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -195,7 +195,7 @@ typedef struct
WORD PrintNameOffset;
WORD PrintNameLength;
WCHAR PathBuffer[1];
-} REPARSE_JUNCTION_DATA_BUFFER;
+} REPARSE_JUNCTION_DATA_BUFFER;
#define REPARSE_JUNCTION_DATA_BUFFER_HEADER_SIZE \
FIELD_OFFSET(REPARSE_JUNCTION_DATA_BUFFER, SubstituteNameOffset)
@@ -260,7 +260,7 @@ pgsymlink(const char *oldpath, const char *newpath)
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, GetLastError(),
MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT),
- (LPSTR) & msg, 0, NULL);
+ (LPSTR) &msg, 0, NULL);
#ifndef FRONTEND
ereport(ERROR,
(errcode_for_file_access(),
@@ -291,7 +291,7 @@ pgsymlink(const char *oldpath, const char *newpath)
* must call pgfnames_cleanup later to free the memory allocated by this
* function.
*/
-char **
+char **
pgfnames(const char *path)
{
DIR *dir;
@@ -412,11 +412,11 @@ rmtree(const char *path, bool rmtopdir)
* delete it anyway.
*
* This is not an academic possibility. One scenario where this
- * happens is when bgwriter has a pending unlink request for a file
- * in a database that's being dropped. In dropdb(), we call
+ * happens is when bgwriter has a pending unlink request for a file in
+ * a database that's being dropped. In dropdb(), we call
* ForgetDatabaseFsyncRequests() to flush out any such pending unlink
- * requests, but because that's asynchronous, it's not guaranteed
- * that the bgwriter receives the message in time.
+ * requests, but because that's asynchronous, it's not guaranteed that
+ * the bgwriter receives the message in time.
*/
if (lstat(pathbuf, &statbuf) != 0)
{
@@ -492,10 +492,10 @@ rmtree(const char *path, bool rmtopdir)
* field when run. So we define our own version that uses the Win32 API
* to update this field.
*/
-int
-pgwin32_safestat(const char *path, struct stat *buf)
+int
+pgwin32_safestat(const char *path, struct stat * buf)
{
- int r;
+ int r;
WIN32_FILE_ATTRIBUTE_DATA attr;
r = stat(path, buf);
@@ -509,8 +509,8 @@ pgwin32_safestat(const char *path, struct stat *buf)
}
/*
- * XXX no support for large files here, but we don't do that in
- * general on Win32 yet.
+ * XXX no support for large files here, but we don't do that in general on
+ * Win32 yet.
*/
buf->st_size = attr.nFileSizeLow;
diff --git a/src/port/exec.c b/src/port/exec.c
index f508777b57..dde509eeeb 100644
--- a/src/port/exec.c
+++ b/src/port/exec.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/exec.c,v 1.62 2009/01/01 17:24:04 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/exec.c,v 1.63 2009/06/11 14:49:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -56,7 +56,7 @@ static int resolve_symlinks(char *path);
static char *pipe_read_line(char *cmd, char *line, int maxsize);
#ifdef WIN32
-static BOOL GetUserSid(PSID * ppSidUser, HANDLE hToken);
+static BOOL GetUserSid(PSID *ppSidUser, HANDLE hToken);
#endif
/*
@@ -736,7 +736,7 @@ AddUserToDacl(HANDLE hProcess)
}
/* Get the ACL info */
- if (!GetAclInformation(ptdd->DefaultDacl, (LPVOID) & asi,
+ if (!GetAclInformation(ptdd->DefaultDacl, (LPVOID) &asi,
(DWORD) sizeof(ACL_SIZE_INFORMATION),
AclSizeInformation))
{
@@ -752,7 +752,7 @@ AddUserToDacl(HANDLE hProcess)
}
/* Figure out the size of the new ACL */
- dwNewAclSize = asi.AclBytesInUse + sizeof(ACCESS_ALLOWED_ACE) + GetLengthSid(psidUser) - sizeof(DWORD);
+ dwNewAclSize = asi.AclBytesInUse + sizeof(ACCESS_ALLOWED_ACE) + GetLengthSid(psidUser) -sizeof(DWORD);
/* Allocate the ACL buffer & initialize it */
pacl = (PACL) LocalAlloc(LPTR, dwNewAclSize);
@@ -771,7 +771,7 @@ AddUserToDacl(HANDLE hProcess)
/* Loop through the existing ACEs, and build the new ACL */
for (i = 0; i < (int) asi.AceCount; i++)
{
- if (!GetAce(ptdd->DefaultDacl, i, (LPVOID *) & pace))
+ if (!GetAce(ptdd->DefaultDacl, i, (LPVOID *) &pace))
{
log_error("could not get ACE: %lu", GetLastError());
goto cleanup;
@@ -794,7 +794,7 @@ AddUserToDacl(HANDLE hProcess)
/* Set the new DACL in the token */
tddNew.DefaultDacl = pacl;
- if (!SetTokenInformation(hToken, tic, (LPVOID) & tddNew, dwNewAclSize))
+ if (!SetTokenInformation(hToken, tic, (LPVOID) &tddNew, dwNewAclSize))
{
log_error("could not set token information: %lu", GetLastError());
goto cleanup;
@@ -824,7 +824,7 @@ cleanup:
* Get the SID for the current user
*/
static BOOL
-GetUserSid(PSID * ppSidUser, HANDLE hToken)
+GetUserSid(PSID *ppSidUser, HANDLE hToken)
{
DWORD dwLength;
PTOKEN_USER pTokenUser = NULL;
diff --git a/src/port/getopt.c b/src/port/getopt.c
index 1c1ba8e1a8..ed7f421a47 100644
--- a/src/port/getopt.c
+++ b/src/port/getopt.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/port/getopt.c,v 1.13 2009/04/04 22:36:11 tgl Exp $ */
+/* $PostgreSQL: pgsql/src/port/getopt.c,v 1.14 2009/06/11 14:49:15 momjian Exp $ */
/* This is used by psql under Win32 */
@@ -49,14 +49,12 @@ int opterr = 1, /* if error message should be printed */
optind = 1, /* index into parent argv vector */
optopt; /* character checked for validity */
char *optarg; /* argument associated with option */
-
#else
extern int opterr;
extern int optind;
extern int optopt;
extern char *optarg;
-
#endif
#ifndef HAVE_INT_OPTRESET
diff --git a/src/port/getopt_long.c b/src/port/getopt_long.c
index 504e989f02..9433b56827 100644
--- a/src/port/getopt_long.c
+++ b/src/port/getopt_long.c
@@ -31,7 +31,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $PostgreSQL: pgsql/src/port/getopt_long.c,v 1.7 2009/04/05 04:19:59 tgl Exp $
+ * $PostgreSQL: pgsql/src/port/getopt_long.c,v 1.8 2009/06/11 14:49:15 momjian Exp $
*/
#include "c.h"
@@ -40,6 +40,7 @@
#ifndef HAVE_INT_OPTRESET
int optreset;
+
/* else the "extern" was provided by getopt_long.h */
#endif
diff --git a/src/port/getrusage.c b/src/port/getrusage.c
index c4311647e8..0db4aeddef 100644
--- a/src/port/getrusage.c
+++ b/src/port/getrusage.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/getrusage.c,v 1.16 2009/01/01 17:24:04 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/getrusage.c,v 1.17 2009/06/11 14:49:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -47,7 +47,7 @@ getrusage(int who, struct rusage * rusage)
errno = EINVAL;
return -1;
}
-
+
if (rusage == (struct rusage *) NULL)
{
errno = EFAULT;
diff --git a/src/port/open.c b/src/port/open.c
index a0c4797108..b9dc8d0d20 100644
--- a/src/port/open.c
+++ b/src/port/open.c
@@ -6,7 +6,7 @@
*
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/port/open.c,v 1.27 2009/01/01 17:24:04 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/open.c,v 1.28 2009/06/11 14:49:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -82,24 +82,25 @@ pgwin32_open(const char *fileName, int fileFlags,...)
((fileFlags & O_WRONLY) ? GENERIC_WRITE : GENERIC_READ),
/* These flags allow concurrent rename/unlink */
(FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE),
- &sa,
- openFlagsToCreateFileFlags(fileFlags),
- FILE_ATTRIBUTE_NORMAL |
+ &sa,
+ openFlagsToCreateFileFlags(fileFlags),
+ FILE_ATTRIBUTE_NORMAL |
((fileFlags & O_RANDOM) ? FILE_FLAG_RANDOM_ACCESS : 0) |
((fileFlags & O_SEQUENTIAL) ? FILE_FLAG_SEQUENTIAL_SCAN : 0) |
((fileFlags & _O_SHORT_LIVED) ? FILE_ATTRIBUTE_TEMPORARY : 0) |
((fileFlags & O_TEMPORARY) ? FILE_FLAG_DELETE_ON_CLOSE : 0) |
((fileFlags & O_DIRECT) ? FILE_FLAG_NO_BUFFERING : 0) |
- ((fileFlags & O_DSYNC) ? FILE_FLAG_WRITE_THROUGH : 0),
- NULL)) == INVALID_HANDLE_VALUE)
+ ((fileFlags & O_DSYNC) ? FILE_FLAG_WRITE_THROUGH : 0),
+ NULL)) == INVALID_HANDLE_VALUE)
{
/*
* Sharing violation or locking error can indicate antivirus, backup
- * or similar software that's locking the file. Try again for 30 seconds
- * before giving up.
+ * or similar software that's locking the file. Try again for 30
+ * seconds before giving up.
*/
- DWORD err = GetLastError();
- if (err == ERROR_SHARING_VIOLATION ||
+ DWORD err = GetLastError();
+
+ if (err == ERROR_SHARING_VIOLATION ||
err == ERROR_LOCK_VIOLATION)
{
pg_usleep(100000);
@@ -108,10 +109,10 @@ pgwin32_open(const char *fileName, int fileFlags,...)
#ifndef FRONTEND
if (loops == 50)
ereport(LOG,
- (errmsg("could not open file \"%s\": %s", fileName,
- (err == ERROR_SHARING_VIOLATION)?_("sharing violation"):_("lock violation")),
- errdetail("Continuing to retry for 30 seconds."),
- errhint("You might have antivirus, backup, or similar software interfering with the database system.")));
+ (errmsg("could not open file \"%s\": %s", fileName,
+ (err == ERROR_SHARING_VIOLATION) ? _("sharing violation") : _("lock violation")),
+ errdetail("Continuing to retry for 30 seconds."),
+ errhint("You might have antivirus, backup, or similar software interfering with the database system.")));
#endif
if (loops < 300)
diff --git a/src/port/path.c b/src/port/path.c
index 7aa39c3195..3fc1ef33b5 100644
--- a/src/port/path.c
+++ b/src/port/path.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/path.c,v 1.78 2009/04/03 23:27:17 tgl Exp $
+ * $PostgreSQL: pgsql/src/port/path.c,v 1.79 2009/06/11 14:49:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -432,7 +432,7 @@ dir_strcmp(const char *s1, const char *s2)
#ifndef WIN32
*s1 != *s2
#else
- /* On windows, paths are case-insensitive */
+ /* On windows, paths are case-insensitive */
pg_tolower((unsigned char) *s1) != pg_tolower((unsigned char) *s2)
#endif
&& !(IS_DIR_SEP(*s1) && IS_DIR_SEP(*s2)))
diff --git a/src/port/pipe.c b/src/port/pipe.c
index a3bbbcab4f..a6df1a4ee1 100644
--- a/src/port/pipe.c
+++ b/src/port/pipe.c
@@ -10,7 +10,7 @@
* must be replaced with recv/send.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/pipe.c,v 1.14 2009/01/01 17:24:04 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/pipe.c,v 1.15 2009/06/11 14:49:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -37,7 +37,7 @@ pgpipe(int handles[2])
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(0);
serv_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- if (bind(s, (SOCKADDR *) & serv_addr, len) == SOCKET_ERROR)
+ if (bind(s, (SOCKADDR *) &serv_addr, len) == SOCKET_ERROR)
{
ereport(LOG, (errmsg_internal("pgpipe failed to bind: %ui", WSAGetLastError())));
closesocket(s);
@@ -49,7 +49,7 @@ pgpipe(int handles[2])
closesocket(s);
return -1;
}
- if (getsockname(s, (SOCKADDR *) & serv_addr, &len) == SOCKET_ERROR)
+ if (getsockname(s, (SOCKADDR *) &serv_addr, &len) == SOCKET_ERROR)
{
ereport(LOG, (errmsg_internal("pgpipe failed to getsockname: %ui", WSAGetLastError())));
closesocket(s);
@@ -62,13 +62,13 @@ pgpipe(int handles[2])
return -1;
}
- if (connect(handles[1], (SOCKADDR *) & serv_addr, len) == SOCKET_ERROR)
+ if (connect(handles[1], (SOCKADDR *) &serv_addr, len) == SOCKET_ERROR)
{
ereport(LOG, (errmsg_internal("pgpipe failed to connect socket: %ui", WSAGetLastError())));
closesocket(s);
return -1;
}
- if ((handles[0] = accept(s, (SOCKADDR *) & serv_addr, &len)) == INVALID_SOCKET)
+ if ((handles[0] = accept(s, (SOCKADDR *) &serv_addr, &len)) == INVALID_SOCKET)
{
ereport(LOG, (errmsg_internal("pgpipe failed to accept socket: %ui", WSAGetLastError())));
closesocket(handles[1]);
diff --git a/src/port/pthread-win32.h b/src/port/pthread-win32.h
index e8e4a559ce..799637345d 100644
--- a/src/port/pthread-win32.h
+++ b/src/port/pthread-win32.h
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/src/port/pthread-win32.h,v 1.5 2008/05/21 14:20:48 mha Exp $
+ * $PostgreSQL: pgsql/src/port/pthread-win32.h,v 1.6 2009/06/11 14:49:15 momjian Exp $
*/
#ifndef __PTHREAD_H
#define __PTHREAD_H
diff --git a/src/port/rand.c b/src/port/rand.c
index c9a966c9eb..8559ef8c17 100644
--- a/src/port/rand.c
+++ b/src/port/rand.c
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/src/port/rand.c,v 1.5 2008/05/17 01:28:25 adunstan Exp $
+ * $PostgreSQL: pgsql/src/port/rand.c,v 1.6 2009/06/11 14:49:15 momjian Exp $
*
*-------------------------------------------------------------------------
*
diff --git a/src/port/strlcat.c b/src/port/strlcat.c
index 9099b45c5f..cab2e9adf7 100644
--- a/src/port/strlcat.c
+++ b/src/port/strlcat.c
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/src/port/strlcat.c,v 1.3 2008/05/17 01:28:25 adunstan Exp $
+ * $PostgreSQL: pgsql/src/port/strlcat.c,v 1.4 2009/06/11 14:49:15 momjian Exp $
*
* $OpenBSD: strlcat.c,v 1.13 2005/08/08 08:05:37 espie Exp $ */
diff --git a/src/port/strtol.c b/src/port/strtol.c
index f9d28f8d0e..d48c896992 100644
--- a/src/port/strtol.c
+++ b/src/port/strtol.c
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/src/port/strtol.c,v 1.16 2009/01/01 17:24:04 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/strtol.c,v 1.17 2009/06/11 14:49:15 momjian Exp $
*
*
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
diff --git a/src/port/strtoul.c b/src/port/strtoul.c
index 8ac6618655..18f04ac179 100644
--- a/src/port/strtoul.c
+++ b/src/port/strtoul.c
@@ -1,5 +1,5 @@
/*
- * $PostgreSQL: pgsql/src/port/strtoul.c,v 1.4 2008/05/17 01:28:25 adunstan Exp $
+ * $PostgreSQL: pgsql/src/port/strtoul.c,v 1.5 2009/06/11 14:49:15 momjian Exp $
*
*
* Copyright (c) 1990, 1993
diff --git a/src/port/win32env.c b/src/port/win32env.c
index 36888286b7..9a32387337 100644
--- a/src/port/win32env.c
+++ b/src/port/win32env.c
@@ -1,16 +1,16 @@
/*-------------------------------------------------------------------------
*
* win32env.c
- * putenv() and unsetenv() for win32, that updates both process
- * environment and the cached versions in (potentially multiple)
- * MSVCRT.
+ * putenv() and unsetenv() for win32, that updates both process
+ * environment and the cached versions in (potentially multiple)
+ * MSVCRT.
*
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/win32env.c,v 1.2 2009/02/12 12:53:34 mha Exp $
+ * $PostgreSQL: pgsql/src/port/win32env.c,v 1.3 2009/06/11 14:49:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -20,41 +20,41 @@
int
pgwin32_putenv(const char *envval)
{
- char *envcpy;
- char *cp;
+ char *envcpy;
+ char *cp;
/*
* Each version of MSVCRT has its own _putenv() call in the runtime
* library.
*
- * If we're in VC 7.0 or later (means != mingw), update in
- * the 6.0 MSVCRT.DLL environment as well, to work with third party
- * libraries linked against it (such as gnuwin32 libraries).
+ * If we're in VC 7.0 or later (means != mingw), update in the 6.0
+ * MSVCRT.DLL environment as well, to work with third party libraries
+ * linked against it (such as gnuwin32 libraries).
*/
#if defined(_MSC_VER) && (_MSC_VER >= 1300)
- typedef int (_cdecl *PUTENVPROC)(const char *);
- HMODULE hmodule;
- static PUTENVPROC putenvFunc = NULL;
- int ret;
+ typedef int (_cdecl * PUTENVPROC) (const char *);
+ HMODULE hmodule;
+ static PUTENVPROC putenvFunc = NULL;
+ int ret;
if (putenvFunc == NULL)
{
hmodule = GetModuleHandle("msvcrt");
if (hmodule == NULL)
return 1;
- putenvFunc = (PUTENVPROC)GetProcAddress(hmodule, "_putenv");
+ putenvFunc = (PUTENVPROC) GetProcAddress(hmodule, "_putenv");
if (putenvFunc == NULL)
return 1;
}
ret = putenvFunc(envval);
if (ret != 0)
return ret;
-#endif /* _MSC_VER >= 1300 */
+#endif /* _MSC_VER >= 1300 */
/*
- * Update the process environment - to make modifications visible
- * to child processes.
+ * Update the process environment - to make modifications visible to child
+ * processes.
*
* Need a copy of the string so we can modify it.
*/
@@ -68,8 +68,8 @@ pgwin32_putenv(const char *envval)
{
/*
* Only call SetEnvironmentVariable() when we are adding a variable,
- * not when removing it. Calling it on both crashes on at least certain
- * versions of MingW.
+ * not when removing it. Calling it on both crashes on at least
+ * certain versions of MingW.
*/
if (!SetEnvironmentVariable(envcpy, cp))
{
@@ -86,9 +86,9 @@ pgwin32_putenv(const char *envval)
void
pgwin32_unsetenv(const char *name)
{
- char *envbuf;
+ char *envbuf;
- envbuf = (char *) malloc(strlen(name)+2);
+ envbuf = (char *) malloc(strlen(name) + 2);
if (!envbuf)
return;
@@ -96,4 +96,3 @@ pgwin32_unsetenv(const char *name)
pgwin32_putenv(envbuf);
free(envbuf);
}
-