diff options
| author | Bruce Momjian <bruce@momjian.us> | 2005-10-15 02:49:52 +0000 |
|---|---|---|
| committer | Bruce Momjian <bruce@momjian.us> | 2005-10-15 02:49:52 +0000 |
| commit | 1dc34982511d91ef8a2b71bdcb870f067c1b3da9 (patch) | |
| tree | 1046adab1d4b964e0c38afeec0ee6546f61d9a8a /src/port | |
| parent | 790c01d28099587bbe2c623d4389b62ee49b1dee (diff) | |
| download | postgresql-1dc34982511d91ef8a2b71bdcb870f067c1b3da9.tar.gz | |
Standard pgindent run for 8.1.
Diffstat (limited to 'src/port')
| -rw-r--r-- | src/port/copydir.c | 8 | ||||
| -rw-r--r-- | src/port/crypt.c | 25 | ||||
| -rw-r--r-- | src/port/dirmod.c | 50 | ||||
| -rw-r--r-- | src/port/exec.c | 65 | ||||
| -rw-r--r-- | src/port/getaddrinfo.c | 32 | ||||
| -rw-r--r-- | src/port/getopt.c | 3 | ||||
| -rw-r--r-- | src/port/getopt_long.c | 4 | ||||
| -rw-r--r-- | src/port/getrusage.c | 26 | ||||
| -rw-r--r-- | src/port/inet_aton.c | 10 | ||||
| -rw-r--r-- | src/port/isinf.c | 8 | ||||
| -rw-r--r-- | src/port/memcmp.c | 14 | ||||
| -rw-r--r-- | src/port/noblock.c | 5 | ||||
| -rw-r--r-- | src/port/open.c | 24 | ||||
| -rw-r--r-- | src/port/path.c | 75 | ||||
| -rw-r--r-- | src/port/qsort.c | 14 | ||||
| -rw-r--r-- | src/port/snprintf.c | 39 | ||||
| -rw-r--r-- | src/port/sprompt.c | 7 | ||||
| -rw-r--r-- | src/port/strtol.c | 23 | ||||
| -rw-r--r-- | src/port/thread.c | 7 | ||||
| -rw-r--r-- | src/port/unsetenv.c | 25 |
20 files changed, 222 insertions, 242 deletions
diff --git a/src/port/copydir.c b/src/port/copydir.c index a5cd967ed7..b2f9070046 100644 --- a/src/port/copydir.c +++ b/src/port/copydir.c @@ -11,7 +11,7 @@ * as a service. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/copydir.c,v 1.14 2005/09/03 15:55:00 tgl Exp $ + * $PostgreSQL: pgsql/src/port/copydir.c,v 1.15 2005/10/15 02:49:50 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -66,11 +66,11 @@ copydir(char *fromdir, char *todir, bool recurse) while ((xlde = ReadDir(xldir, fromdir)) != NULL) { - struct stat fst; + struct stat fst; - if (strcmp(xlde->d_name, ".") == 0 || + if (strcmp(xlde->d_name, ".") == 0 || strcmp(xlde->d_name, "..") == 0) - continue; + continue; snprintf(fromfile, MAXPGPATH, "%s/%s", fromdir, xlde->d_name); snprintf(tofile, MAXPGPATH, "%s/%s", todir, xlde->d_name); diff --git a/src/port/crypt.c b/src/port/crypt.c index 5488fe60ce..d3c01d2f38 100644 --- a/src/port/crypt.c +++ b/src/port/crypt.c @@ -11,18 +11,18 @@ * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) @@ -35,7 +35,6 @@ #if defined(LIBC_SCCS) && !defined(lint) #if 0 static char sccsid[] = "@(#)crypt.c 8.1.1.1 (Berkeley) 8/18/93"; - #else __RCSID("$NetBSD: crypt.c,v 1.18 2001/03/01 14:37:35 wiz Exp $"); #endif @@ -330,7 +329,7 @@ int chars_in; /* ===== (mostly) Standard DES Tables ==================== */ -static const unsigned char IP[] = { /* initial permutation */ +static const unsigned char IP[] = { /* initial permutation */ 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4, 62, 54, 46, 38, 30, 22, 14, 6, @@ -383,7 +382,7 @@ static const unsigned char PC2[] = { /* permuted choice table 2 */ 0, 0, 46, 42, 50, 36, 29, 32, }; -static const unsigned char S[8][64] = { /* 48->32 bit substitution tables */ +static const unsigned char S[8][64] = { /* 48->32 bit substitution tables */ /* S[1] */ {14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7, 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8, @@ -437,7 +436,7 @@ static const unsigned char P32Tr[] = { /* 32-bit permutation function */ 22, 11, 4, 25, }; -static const unsigned char CIFP[] = { /* compressed/interleaved permutation */ +static const unsigned char CIFP[] = { /* compressed/interleaved permutation */ 1, 2, 3, 4, 17, 18, 19, 20, 5, 6, 7, 8, 21, 22, 23, 24, 9, 10, 11, 12, 25, 26, 27, 28, @@ -449,7 +448,7 @@ static const unsigned char CIFP[] = { /* compressed/interleaved permutation */ 45, 46, 47, 48, 61, 62, 63, 64, }; -static const unsigned char itoa64[] = /* 0..63 => ascii-64 */ +static const unsigned char itoa64[] = /* 0..63 => ascii-64 */ "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; @@ -523,8 +522,7 @@ const char *setting; key++; keyblock.b[i] = t; } - if (des_setkey((char *) keyblock.b)) /* also initializes - * "a64toi" */ + if (des_setkey((char *) keyblock.b)) /* also initializes "a64toi" */ return (NULL); encp = &cryptresult[0]; @@ -816,6 +814,7 @@ init_des() int tableno; static unsigned char perm[64], tmp32[32]; /* "static" for speed */ + /* static volatile long init_start = 0; not used */ /* diff --git a/src/port/dirmod.c b/src/port/dirmod.c index 48f0914224..d79b9f2fb5 100644 --- a/src/port/dirmod.c +++ b/src/port/dirmod.c @@ -10,7 +10,7 @@ * Win32 (NT, Win2k, XP). replace() doesn't work on Win95/98/Me. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/dirmod.c,v 1.40 2005/09/18 09:48:24 petere Exp $ + * $PostgreSQL: pgsql/src/port/dirmod.c,v 1.41 2005/10/15 02:49:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -53,8 +53,7 @@ #define palloc(sz) pgport_palloc(sz) #define pstrdup(str) pgport_pstrdup(str) #endif - -#else /* FRONTEND */ +#else /* FRONTEND */ /* * In frontend, fake palloc behavior with these @@ -104,8 +103,7 @@ fe_repalloc(void *pointer, Size size) } return res; } - -#endif /* FRONTEND */ +#endif /* FRONTEND */ #if defined(WIN32) || defined(__CYGWIN__) @@ -119,9 +117,9 @@ pgrename(const char *from, const char *to) int loops = 0; /* - * We need these loops because even though PostgreSQL uses flags - * that allow rename while the file is open, other applications - * might have these files open without those flags. + * We need these loops because even though PostgreSQL uses flags that + * allow rename while the file is open, other applications might have + * these files open without those flags. */ #if defined(WIN32) && !defined(__CYGWIN__) while (!MoveFileEx(from, to, MOVEFILE_REPLACE_EXISTING)) @@ -169,9 +167,9 @@ pgunlink(const char *path) int loops = 0; /* - * We need these loops because even though PostgreSQL uses flags - * that allow unlink while the file is open, other applications - * might have these files open without those flags. + * We need these loops because even though PostgreSQL uses flags that + * allow unlink while the file is open, other applications might have + * these files open without those flags. */ while (unlink(path)) { @@ -200,7 +198,7 @@ pgunlink(const char *path) } -#ifdef WIN32 /* Cygwin has its own symlinks */ +#ifdef WIN32 /* Cygwin has its own symlinks */ /* * pgsymlink support: @@ -244,7 +242,7 @@ pgsymlink(const char *oldpath, const char *newpath) CreateDirectory(newpath, 0); dirhandle = CreateFile(newpath, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, - FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, 0); + FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, 0); if (dirhandle == INVALID_HANDLE_VALUE) return -1; @@ -270,13 +268,13 @@ pgsymlink(const char *oldpath, const char *newpath) reparseBuf->PathBuffer, MAX_PATH); /* - * FSCTL_SET_REPARSE_POINT is coded differently depending on SDK - * version; we use our own definition + * FSCTL_SET_REPARSE_POINT is coded differently depending on SDK version; + * we use our own definition */ if (!DeviceIoControl(dirhandle, - CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, FILE_ANY_ACCESS), + CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 41, METHOD_BUFFERED, FILE_ANY_ACCESS), reparseBuf, - reparseBuf->ReparseDataLength + REPARSE_JUNCTION_DATA_BUFFER_HEADER_SIZE, + reparseBuf->ReparseDataLength + REPARSE_JUNCTION_DATA_BUFFER_HEADER_SIZE, 0, 0, &len, 0)) { LPSTR msg; @@ -306,10 +304,8 @@ pgsymlink(const char *oldpath, const char *newpath) return 0; } - -#endif /* WIN32 */ - -#endif /* defined(WIN32) || defined(__CYGWIN__) */ +#endif /* WIN32 */ +#endif /* defined(WIN32) || defined(__CYGWIN__) */ /* We undefined this above, so we redefine it */ @@ -321,7 +317,7 @@ pgsymlink(const char *oldpath, const char *newpath) /* * fnames * - * return a list of the names of objects in the argument directory + * return a list of the names of objects in the argument directory */ static char ** fnames(char *path) @@ -351,7 +347,7 @@ fnames(char *path) { if (strcmp(file->d_name, ".") != 0 && strcmp(file->d_name, "..") != 0) { - if (numnames+1 >= fnsize) + if (numnames + 1 >= fnsize) { fnsize *= 2; filenames = (char **) repalloc(filenames, @@ -364,8 +360,8 @@ fnames(char *path) #ifdef WIN32 /* - * This fix is in mingw cvs (runtime/mingwex/dirent.c rev 1.4), but - * not in released version + * This fix is in mingw cvs (runtime/mingwex/dirent.c rev 1.4), but not in + * released version */ if (GetLastError() == ERROR_NO_MORE_FILES) errno = 0; @@ -423,8 +419,8 @@ rmtree(char *path, bool rmtopdir) struct stat statbuf; /* - * we copy all the names out of the directory before we start - * modifying it. + * we copy all the names out of the directory before we start modifying + * it. */ filenames = fnames(path); diff --git a/src/port/exec.c b/src/port/exec.c index 8220536c03..e754b18215 100644 --- a/src/port/exec.c +++ b/src/port/exec.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/exec.c,v 1.38 2005/02/22 04:43:16 momjian Exp $ + * $PostgreSQL: pgsql/src/port/exec.c,v 1.39 2005/10/15 02:49:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -75,7 +75,6 @@ validate_exec(const char *path) struct passwd *pwp; int i; int in_grp = 0; - #else char path_exe[MAXPGPATH + sizeof(".exe") - 1]; #endif @@ -96,8 +95,8 @@ validate_exec(const char *path) /* * Ensure that the file exists and is a regular file. * - * XXX if you have a broken system where stat() looks at the symlink - * instead of the underlying file, you lose. + * XXX if you have a broken system where stat() looks at the symlink instead + * of the underlying file, you lose. */ if (stat(path, &buf) < 0) return -1; @@ -222,8 +221,8 @@ find_my_exec(const char *argv0, char *retpath) #endif /* - * Since no explicit path was supplied, the user must have - * been relying on PATH. We'll search the same PATH. + * Since no explicit path was supplied, the user must have been relying on + * PATH. We'll search the same PATH. */ if ((path = getenv("PATH")) && *path) { @@ -254,7 +253,7 @@ find_my_exec(const char *argv0, char *retpath) switch (validate_exec(retpath)) { - case 0: /* found ok */ + case 0: /* found ok */ return resolve_symlinks(retpath); case -1: /* wasn't even a candidate, keep looking */ break; @@ -292,16 +291,16 @@ resolve_symlinks(char *path) char *fname; /* - * To resolve a symlink properly, we have to chdir into its directory - * and then chdir to where the symlink points; otherwise we may fail to + * To resolve a symlink properly, we have to chdir into its directory and + * then chdir to where the symlink points; otherwise we may fail to * resolve relative links correctly (consider cases involving mount * points, for example). After following the final symlink, we use * getcwd() to figure out where the heck we're at. * - * One might think we could skip all this if path doesn't point to a - * symlink to start with, but that's wrong. We also want to get rid - * of any directory symlinks that are present in the given path. - * We expect getcwd() to give us an accurate, symlink-free path. + * One might think we could skip all this if path doesn't point to a symlink + * to start with, but that's wrong. We also want to get rid of any + * directory symlinks that are present in the given path. We expect + * getcwd() to give us an accurate, symlink-free path. */ if (!getcwd(orig_wd, MAXPGPATH)) { @@ -312,8 +311,8 @@ resolve_symlinks(char *path) for (;;) { - char *lsep; - int rllen; + char *lsep; + int rllen; lsep = last_dir_separator(path); if (lsep) @@ -360,8 +359,7 @@ resolve_symlinks(char *path) log_error(_("could not change directory to \"%s\""), orig_wd); return -1; } - -#endif /* HAVE_READLINK */ +#endif /* HAVE_READLINK */ return 0; } @@ -435,8 +433,7 @@ pipe_read_line(char *cmd, char *line, int maxsize) return NULL; return line; - -#else /* WIN32 */ +#else /* WIN32 */ SECURITY_ATTRIBUTES sattr; HANDLE childstdoutrd, @@ -488,31 +485,31 @@ pipe_read_line(char *cmd, char *line, int maxsize) &pi)) { /* Successfully started the process */ - char *lineptr; + char *lineptr; ZeroMemory(line, maxsize); /* Try to read at least one line from the pipe */ /* This may require more than one wait/read attempt */ - for (lineptr = line; lineptr < line+maxsize-1; ) + for (lineptr = line; lineptr < line + maxsize - 1;) { DWORD bytesread = 0; /* Let's see if we can read */ if (WaitForSingleObject(childstdoutrddup, 10000) != WAIT_OBJECT_0) - break; /* Timeout, but perhaps we got a line already */ + break; /* Timeout, but perhaps we got a line already */ - if (!ReadFile(childstdoutrddup, lineptr, maxsize-(lineptr-line), + if (!ReadFile(childstdoutrddup, lineptr, maxsize - (lineptr - line), &bytesread, NULL)) - break; /* Error, but perhaps we got a line already */ + break; /* Error, but perhaps we got a line already */ lineptr += strlen(lineptr); if (!bytesread) - break; /* EOF */ + break; /* EOF */ if (strchr(line, '\n')) - break; /* One or more lines read */ + break; /* One or more lines read */ } if (lineptr != line) @@ -521,18 +518,18 @@ pipe_read_line(char *cmd, char *line, int maxsize) int len; /* If we got more than one line, cut off after the first \n */ - lineptr = strchr(line,'\n'); + lineptr = strchr(line, '\n'); if (lineptr) - *(lineptr+1) = '\0'; + *(lineptr + 1) = '\0'; len = strlen(line); /* * If EOL is \r\n, convert to just \n. Because stdout is a * text-mode stream, the \n output by the child process is - * received as \r\n, so we convert it to \n. The server - * main.c sets setvbuf(stdout, NULL, _IONBF, 0) which has the - * effect of disabling \n to \r\n expansion for stdout. + * received as \r\n, so we convert it to \n. The server main.c + * sets setvbuf(stdout, NULL, _IONBF, 0) which has the effect of + * disabling \n to \r\n expansion for stdout. */ if (len >= 2 && line[len - 2] == '\r' && line[len - 1] == '\n') { @@ -542,8 +539,8 @@ pipe_read_line(char *cmd, char *line, int maxsize) } /* - * We emulate fgets() behaviour. So if there is no newline at - * the end, we add one... + * We emulate fgets() behaviour. So if there is no newline at the + * end, we add one... */ if (len == 0 || line[len - 1] != '\n') strcat(line, "\n"); @@ -559,7 +556,7 @@ pipe_read_line(char *cmd, char *line, int maxsize) CloseHandle(childstdoutrddup); return retval; -#endif /* WIN32 */ +#endif /* WIN32 */ } diff --git a/src/port/getaddrinfo.c b/src/port/getaddrinfo.c index 86b21b3af6..49a7293dec 100644 --- a/src/port/getaddrinfo.c +++ b/src/port/getaddrinfo.c @@ -16,7 +16,7 @@ * Copyright (c) 2003-2005, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/getaddrinfo.c,v 1.20 2005/10/13 23:22:11 momjian Exp $ + * $PostgreSQL: pgsql/src/port/getaddrinfo.c,v 1.21 2005/10/15 02:49:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -46,17 +46,17 @@ * Here we need to declare what the function pointers look like */ typedef int (__stdcall * getaddrinfo_ptr_t) (const char *nodename, - const char *servname, - const struct addrinfo * hints, - struct addrinfo ** res); + const char *servname, + const struct addrinfo * hints, + struct addrinfo ** res); typedef void (__stdcall * freeaddrinfo_ptr_t) (struct addrinfo * ai); typedef int (__stdcall * getnameinfo_ptr_t) (const struct sockaddr * sa, - int salen, - char *host, int hostlen, - char *serv, int servlen, - int flags); + int salen, + char *host, int hostlen, + char *serv, int servlen, + int flags); /* static pointers to the native routines, so we only do the lookup once. */ static getaddrinfo_ptr_t getaddrinfo_ptr = NULL; @@ -74,9 +74,8 @@ haveNativeWindowsIPv6routines(void) return (getaddrinfo_ptr != NULL); /* - * For Windows XP and Windows 2003 (and longhorn/vista), the IPv6 - * routines are present in the WinSock 2 library (ws2_32.dll). - * Try that first + * For Windows XP and Windows 2003 (and longhorn/vista), the IPv6 routines + * are present in the WinSock 2 library (ws2_32.dll). Try that first */ hLibrary = LoadLibraryA("ws2_32"); @@ -106,7 +105,7 @@ haveNativeWindowsIPv6routines(void) getaddrinfo_ptr = (getaddrinfo_ptr_t) GetProcAddress(hLibrary, "getaddrinfo"); freeaddrinfo_ptr = (freeaddrinfo_ptr_t) GetProcAddress(hLibrary, - "freeaddrinfo"); + "freeaddrinfo"); getnameinfo_ptr = (getnameinfo_ptr_t) GetProcAddress(hLibrary, "getnameinfo"); @@ -129,7 +128,6 @@ haveNativeWindowsIPv6routines(void) alreadyLookedForIpv6routines = true; return (getaddrinfo_ptr != NULL); } - #endif @@ -152,6 +150,7 @@ getaddrinfo(const char *node, const char *service, struct addrinfo hints; #ifdef WIN32 + /* * If Windows has native IPv6 support, use the native Windows routine. * Otherwise, fall through and use our own code. @@ -274,6 +273,7 @@ freeaddrinfo(struct addrinfo * res) if (res) { #ifdef WIN32 + /* * If Windows has native IPv6 support, use the native Windows routine. * Otherwise, fall through and use our own code. @@ -313,8 +313,7 @@ gai_strerror(int errcode) } return hstrerror(hcode); - -#else /* !HAVE_HSTRERROR */ +#else /* !HAVE_HSTRERROR */ switch (errcode) { @@ -322,7 +321,7 @@ gai_strerror(int errcode) return "Unknown host"; case EAI_AGAIN: return "Host name lookup failure"; - /* Errors below are probably WIN32 only */ + /* Errors below are probably WIN32 only */ #ifdef EAI_BADFLAGS case EAI_BADFLAGS: return "Invalid argument"; @@ -366,6 +365,7 @@ getnameinfo(const struct sockaddr * sa, int salen, char *service, int servicelen, int flags) { #ifdef WIN32 + /* * If Windows has native IPv6 support, use the native Windows routine. * Otherwise, fall through and use our own code. diff --git a/src/port/getopt.c b/src/port/getopt.c index 48d10fb9ee..28a0d0a476 100644 --- a/src/port/getopt.c +++ b/src/port/getopt.c @@ -81,8 +81,7 @@ const char *ostr; !(oli = strchr(ostr, optopt))) { /* - * if the user didn't specify '-' as an option, assume it means - * -1. + * if the user didn't specify '-' as an option, assume it means -1. */ if (optopt == (int) '-') return -1; diff --git a/src/port/getopt_long.c b/src/port/getopt_long.c index 2bf0c8c9e3..5ef058f892 100644 --- a/src/port/getopt_long.c +++ b/src/port/getopt_long.c @@ -35,7 +35,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.4 2005/07/28 04:03:14 tgl Exp $ + * $PostgreSQL: pgsql/src/port/getopt_long.c,v 1.5 2005/10/15 02:49:51 momjian Exp $ */ #include "c.h" @@ -115,7 +115,7 @@ getopt_long(int argc, char *const argv[], return BADARG; if (opterr) fprintf(stderr, - "%s: option requires an argument -- %s\n", + "%s: option requires an argument -- %s\n", argv[0], place); place = EMSG; optind++; diff --git a/src/port/getrusage.c b/src/port/getrusage.c index 49d87d4c6f..b496429de1 100644 --- a/src/port/getrusage.c +++ b/src/port/getrusage.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/getrusage.c,v 1.10 2005/07/28 04:03:14 tgl Exp $ + * $PostgreSQL: pgsql/src/port/getrusage.c,v 1.11 2005/10/15 02:49:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -35,13 +35,13 @@ getrusage(int who, struct rusage * rusage) { #ifdef WIN32 - FILETIME starttime; - FILETIME exittime; - FILETIME kerneltime; - FILETIME usertime; + FILETIME starttime; + FILETIME exittime; + FILETIME kerneltime; + FILETIME usertime; ULARGE_INTEGER li; - if (rusage == (struct rusage *)NULL) + if (rusage == (struct rusage *) NULL) { errno = EFAULT; return -1; @@ -56,16 +56,15 @@ getrusage(int who, struct rusage * rusage) /* Convert FILETIMEs (0.1 us) to struct timeval */ memcpy(&li, &kerneltime, sizeof(FILETIME)); - li.QuadPart /= 10L; /* Convert to microseconds */ - rusage->ru_stime.tv_sec = li.QuadPart / 1000000L; + li.QuadPart /= 10L; /* Convert to microseconds */ + rusage->ru_stime.tv_sec = li.QuadPart / 1000000L; rusage->ru_stime.tv_usec = li.QuadPart % 1000000L; memcpy(&li, &usertime, sizeof(FILETIME)); - li.QuadPart /= 10L; /* Convert to microseconds */ - rusage->ru_utime.tv_sec = li.QuadPart / 1000000L; + li.QuadPart /= 10L; /* Convert to microseconds */ + rusage->ru_utime.tv_sec = li.QuadPart / 1000000L; rusage->ru_utime.tv_usec = li.QuadPart % 1000000L; - -#else /* all but WIN32 */ +#else /* all but WIN32 */ struct tms tms; int tick_rate = CLK_TCK; /* ticks per second */ @@ -102,8 +101,7 @@ getrusage(int who, struct rusage * rusage) rusage->ru_utime.tv_usec = TICK_TO_USEC(u, tick_rate); rusage->ru_stime.tv_sec = TICK_TO_SEC(s, tick_rate); rusage->ru_stime.tv_usec = TICK_TO_USEC(u, tick_rate); - -#endif /* WIN32 */ +#endif /* WIN32 */ return 0; } diff --git a/src/port/inet_aton.c b/src/port/inet_aton.c index 521e61dcf9..f5a64dbdbb 100644 --- a/src/port/inet_aton.c +++ b/src/port/inet_aton.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/port/inet_aton.c,v 1.7 2004/09/27 23:24:45 momjian Exp $ +/* $PostgreSQL: pgsql/src/port/inet_aton.c,v 1.8 2005/10/15 02:49:51 momjian Exp $ * * This inet_aton() function was taken from the GNU C library and * incorporated into Postgres for those systems which do not have this @@ -69,8 +69,8 @@ inet_aton(const char *cp, struct in_addr * addr) for (;;) { /* - * Collect number up to ``.''. Values are specified as for C: - * 0x=hex, 0=octal, other=decimal. + * Collect number up to ``.''. Values are specified as for C: 0x=hex, + * 0=octal, other=decimal. */ val = 0; base = 10; @@ -101,8 +101,8 @@ inet_aton(const char *cp, struct in_addr * addr) if (*cp == '.') { /* - * Internet format: a.b.c.d a.b.c (with c treated as - * 16-bits) a.b (with b treated as 24 bits) + * Internet format: a.b.c.d a.b.c (with c treated as 16-bits) + * a.b (with b treated as 24 bits) */ if (pp >= parts + 3 || val > 0xff) return 0; diff --git a/src/port/isinf.c b/src/port/isinf.c index 147f08c8fd..0ede85a265 100644 --- a/src/port/isinf.c +++ b/src/port/isinf.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/isinf.c,v 1.6 2004/12/31 22:03:53 pgsql Exp $ + * $PostgreSQL: pgsql/src/port/isinf.c,v 1.7 2005/10/15 02:49:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -17,8 +17,7 @@ #include <float.h> #include <math.h> -#if HAVE_FPCLASS /* this is _not_ HAVE_FP_CLASS, and not - * typo */ +#if HAVE_FPCLASS /* this is _not_ HAVE_FP_CLASS, and not typo */ #if HAVE_IEEEFP_H #include <ieeefp.h> @@ -38,7 +37,6 @@ isinf(double d) } return 0; } - #else #if defined(HAVE_FP_CLASS) || defined(HAVE_FP_CLASS_D) @@ -52,7 +50,6 @@ double x; { #if HAVE_FP_CLASS int fpclass = fp_class(x); - #else int fpclass = fp_class_d(x); #endif @@ -63,7 +60,6 @@ double x; return -1; return 0; } - #elif defined(HAVE_CLASS) int isinf(double x) diff --git a/src/port/memcmp.c b/src/port/memcmp.c index c6df6c8df6..1a2d3b84db 100644 --- a/src/port/memcmp.c +++ b/src/port/memcmp.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/memcmp.c,v 1.8 2005/07/28 04:03:14 tgl Exp $ + * $PostgreSQL: pgsql/src/port/memcmp.c,v 1.9 2005/10/15 02:49:51 momjian Exp $ * * This file was taken from NetBSD and is used by SunOS because memcmp * on that platform does not properly compare negative bytes. The @@ -25,18 +25,18 @@ * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) diff --git a/src/port/noblock.c b/src/port/noblock.c index 1e5fb3630e..ca11b344fa 100644 --- a/src/port/noblock.c +++ b/src/port/noblock.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/noblock.c,v 1.7 2005/07/28 04:03:14 tgl Exp $ + * $PostgreSQL: pgsql/src/port/noblock.c,v 1.8 2005/10/15 02:49:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -40,7 +40,8 @@ bool pg_set_block(int sock) { #if !defined(WIN32) && !defined(__BEOS__) - int flags; + int flags; + flags = fcntl(sock, F_GETFL); if (flags < 0 || fcntl(sock, F_SETFL, (long) (flags & ~O_NONBLOCK))) return false; diff --git a/src/port/open.c b/src/port/open.c index fd7e010c1c..d56d5178b2 100644 --- a/src/port/open.c +++ b/src/port/open.c @@ -6,7 +6,7 @@ * * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/port/open.c,v 1.10 2005/07/28 04:03:14 tgl Exp $ + * $PostgreSQL: pgsql/src/port/open.c,v 1.11 2005/10/15 02:49:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -19,7 +19,7 @@ #include <fcntl.h> #include <assert.h> -int win32_open(const char *fileName, int fileFlags, ...); +int win32_open(const char *fileName, int fileFlags,...); static int openFlagsToCreateFileFlags(int openFlags) @@ -64,7 +64,7 @@ win32_open(const char *fileName, int fileFlags,...) assert((fileFlags & ((O_RDONLY | O_WRONLY | O_RDWR) | O_APPEND | (O_RANDOM | O_SEQUENTIAL | O_TEMPORARY) | _O_SHORT_LIVED | O_DSYNC | - (O_CREAT | O_TRUNC | O_EXCL) | (O_TEXT | O_BINARY))) == fileFlags); + (O_CREAT | O_TRUNC | O_EXCL) | (O_TEXT | O_BINARY))) == fileFlags); sa.nLength = sizeof(sa); sa.bInheritHandle = TRUE; @@ -72,18 +72,18 @@ win32_open(const char *fileName, int fileFlags,...) if ((h = CreateFile(fileName, /* cannot use O_RDONLY, as it == 0 */ - (fileFlags & O_RDWR) ? (GENERIC_WRITE | GENERIC_READ) : - ((fileFlags & O_WRONLY) ? GENERIC_WRITE : GENERIC_READ), - /* These flags allow concurrent rename/unlink */ - (FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE), + (fileFlags & O_RDWR) ? (GENERIC_WRITE | GENERIC_READ) : + ((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 | - ((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_DSYNC) ? FILE_FLAG_WRITE_THROUGH : 0), + ((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_DSYNC) ? FILE_FLAG_WRITE_THROUGH : 0), NULL)) == INVALID_HANDLE_VALUE) { switch (GetLastError()) diff --git a/src/port/path.c b/src/port/path.c index a1c91a24dd..c6137bd0a1 100644 --- a/src/port/path.c +++ b/src/port/path.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/path.c,v 1.60 2005/10/13 15:37:14 momjian Exp $ + * $PostgreSQL: pgsql/src/port/path.c,v 1.61 2005/10/15 02:49:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -47,7 +47,7 @@ #endif static void make_relative_path(char *ret_path, const char *target_path, - const char *bin_path, const char *my_exec_path); + const char *bin_path, const char *my_exec_path); static void trim_directory(char *path); static void trim_trailing_separator(char *path); @@ -55,7 +55,7 @@ static void trim_trailing_separator(char *path); /* * skip_drive * - * On Windows, a path may begin with "C:" or "//network/". Advance over + * On Windows, a path may begin with "C:" or "//network/". Advance over * this and point to the effective start of the path. */ #ifdef WIN32 @@ -75,11 +75,9 @@ skip_drive(const char *path) } return (char *) path; } - #else #define skip_drive(path) (path) - #endif /* @@ -177,9 +175,10 @@ join_path_components(char *ret_path, { if (ret_path != head) StrNCpy(ret_path, head, MAXPGPATH); + /* - * Remove any leading "." and ".." in the tail component, - * adjusting head as needed. + * Remove any leading "." and ".." in the tail component, adjusting head + * as needed. */ for (;;) { @@ -224,16 +223,17 @@ join_path_components(char *ret_path, void canonicalize_path(char *path) { - char *p, *to_p; + char *p, + *to_p; char *spath; bool was_sep = false; int pending_strips; #ifdef WIN32 + /* - * The Windows command processor will accept suitably quoted paths - * with forward slashes, but barfs badly with mixed forward and back - * slashes. + * The Windows command processor will accept suitably quoted paths with + * forward slashes, but barfs badly with mixed forward and back slashes. */ for (p = path; *p; p++) { @@ -242,22 +242,22 @@ canonicalize_path(char *path) } /* - * In Win32, if you do: prog.exe "a b" "\c\d\" the system will pass - * \c\d" as argv[2], so trim off trailing quote. + * In Win32, if you do: prog.exe "a b" "\c\d\" the system will pass \c\d" + * as argv[2], so trim off trailing quote. */ if (p > path && *(p - 1) == '"') *(p - 1) = '/'; #endif /* - * Removing the trailing slash on a path means we never get ugly - * double trailing slashes. Also, Win32 can't stat() a directory - * with a trailing slash. Don't remove a leading slash, though. + * Removing the trailing slash on a path means we never get ugly double + * trailing slashes. Also, Win32 can't stat() a directory with a trailing + * slash. Don't remove a leading slash, though. */ trim_trailing_separator(path); /* - * Remove duplicate adjacent separators + * Remove duplicate adjacent separators */ p = path; #ifdef WIN32 @@ -280,12 +280,12 @@ canonicalize_path(char *path) /* * Remove any trailing uses of "." and process ".." ourselves * - * Note that "/../.." should reduce to just "/", while "../.." has to - * be kept as-is. In the latter case we put back mistakenly trimmed - * ".." components below. Also note that we want a Windows drive spec - * to be visible to trim_directory(), but it's not part of the logic - * that's looking at the name components; hence distinction between - * path and spath. + * Note that "/../.." should reduce to just "/", while "../.." has to be kept + * as-is. In the latter case we put back mistakenly trimmed ".." + * components below. Also note that we want a Windows drive spec to be + * visible to trim_directory(), but it's not part of the logic that's + * looking at the name components; hence distinction between path and + * spath. */ spath = skip_drive(path); pending_strips = 0; @@ -324,9 +324,9 @@ canonicalize_path(char *path) if (pending_strips > 0) { /* - * We could only get here if path is now totally empty (other than - * a possible drive specifier on Windows). - * We have to put back one or more ".."'s that we took off. + * We could only get here if path is now totally empty (other than a + * possible drive specifier on Windows). We have to put back one or + * more ".."'s that we took off. */ while (--pending_strips > 0) strcat(path, "../"); @@ -345,15 +345,15 @@ canonicalize_path(char *path) bool path_contains_parent_reference(const char *path) { - int path_len; + int path_len; path = skip_drive(path); /* C: shouldn't affect our conclusion */ path_len = strlen(path); /* - * ".." could be the whole path; otherwise, if it's present it must - * be at the beginning, in the middle, or at the end. + * ".." could be the whole path; otherwise, if it's present it must be at + * the beginning, in the middle, or at the end. */ if (strcmp(path, "..") == 0 || strncmp(path, "../", 3) == 0 || @@ -373,7 +373,7 @@ path_contains_parent_reference(const char *path) bool path_is_prefix_of_path(const char *path1, const char *path2) { - int path1_len = strlen(path1); + int path1_len = strlen(path1); if (strncmp(path1, path2, path1_len) == 0 && (IS_DIR_SEP(path2[path1_len]) || path2[path1_len] == '\0')) @@ -382,7 +382,7 @@ path_is_prefix_of_path(const char *path1, const char *path2) } /* - * Extracts the actual name of the program as called - + * Extracts the actual name of the program as called - * stripped of .exe suffix if any */ const char * @@ -399,18 +399,18 @@ get_progname(const char *argv0) #if defined(__CYGWIN__) || defined(WIN32) /* strip .exe suffix, regardless of case */ if (strlen(nodir_name) > sizeof(EXE) - 1 && - pg_strcasecmp(nodir_name + strlen(nodir_name)-(sizeof(EXE)-1), EXE) == 0) + pg_strcasecmp(nodir_name + strlen(nodir_name) - (sizeof(EXE) - 1), EXE) == 0) { - char *progname; + char *progname; progname = strdup(nodir_name); /* leaks memory, but called only once */ if (progname == NULL) { fprintf(stderr, "%s: out of memory\n", nodir_name); - exit(1); /* This could exit the postmaster */ + exit(1); /* This could exit the postmaster */ } progname[strlen(progname) - (sizeof(EXE) - 1)] = '\0'; - nodir_name = progname; + nodir_name = progname; } #endif @@ -432,10 +432,10 @@ get_progname(const char *argv0) * bin_path, then we build the result as my_exec_path (less the executable * name and last directory) joined to the non-matching part of target_path. * Otherwise, we return target_path as-is. - * + * * For example: * target_path = '/usr/local/share/postgresql' - * bin_path = '/usr/local/bin' + * bin_path = '/usr/local/bin' * my_exec_path = '/opt/pgsql/bin/postmaster' * Given these inputs we would return '/opt/pgsql/share/postgresql' */ @@ -575,7 +575,6 @@ get_home_path(char *ret_path) return false; StrNCpy(ret_path, pwd->pw_dir, MAXPGPATH); return true; - #else char tmppath[MAX_PATH]; diff --git a/src/port/qsort.c b/src/port/qsort.c index 607fcaccb9..71c1f155dd 100644 --- a/src/port/qsort.c +++ b/src/port/qsort.c @@ -3,7 +3,7 @@ * Add do ... while() macro fix * Remove __inline, _DIAGASSERTs, __P * - * $PostgreSQL: pgsql/src/port/qsort.c,v 1.7 2005/07/28 04:03:14 tgl Exp $ + * $PostgreSQL: pgsql/src/port/qsort.c,v 1.8 2005/10/15 02:49:51 momjian Exp $ */ /* $NetBSD: qsort.c,v 1.13 2003/08/07 16:43:42 agc Exp $ */ @@ -16,18 +16,18 @@ * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) diff --git a/src/port/snprintf.c b/src/port/snprintf.c index e7024b038e..910f40320a 100644 --- a/src/port/snprintf.c +++ b/src/port/snprintf.c @@ -62,7 +62,7 @@ * causing nasty effects. **************************************************************/ -/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.28 2005/07/28 04:03:14 tgl Exp $";*/ +/*static char _id[] = "$PostgreSQL: pgsql/src/port/snprintf.c,v 1.29 2005/10/15 02:49:51 momjian Exp $";*/ static void dopr(char *buffer, const char *format, va_list args, char *end); @@ -140,16 +140,16 @@ pg_printf(const char *fmt,...) va_start(args, fmt); len = pg_vsnprintf(buffer, (size_t) 4096, fmt, args); va_end(args); - + for (p = buffer; *p; p++) putchar(*p); return len; } -static int adjust_sign(int is_negative, int forcesign, int *signvalue); +static int adjust_sign(int is_negative, int forcesign, int *signvalue); static void adjust_padlen(int minlen, int vallen, int leftjust, int *padlen); static void leading_pad(int zpad, int *signvalue, int *padlen, char *end, - char **output); + char **output); static void trailing_pad(int *padlen, char *end, char **output); static void fmtstr(char *value, int leftjust, int minlen, int maxwidth, @@ -157,8 +157,8 @@ static void fmtstr(char *value, int leftjust, int minlen, int maxwidth, static void fmtint(int64 value, int base, int dosign, int forcesign, int leftjust, int minlen, int zpad, char *end, char **output); static void fmtfloat(double value, char type, int forcesign, - int leftjust, int minlen, int zpad, int precision, int pointflag, char *end, - char **output); + int leftjust, int minlen, int zpad, int precision, int pointflag, char *end, + char **output); static void dostr(char *str, int cut, char *end, char **output); static void dopr_outch(int c, char *end, char **output); @@ -221,9 +221,9 @@ dopr(char *buffer, const char *format, va_list args, char *end) } *fmtpar, **fmtparptr; /* - * Create enough structures to hold all arguments. This overcounts, - * eg not all '*' characters are necessarily arguments, but it's not - * worth being exact. + * Create enough structures to hold all arguments. This overcounts, eg + * not all '*' characters are necessarily arguments, but it's not worth + * being exact. */ for (p = format; *p != '\0'; p++) if (*p == '%' || *p == '*') @@ -504,8 +504,8 @@ performpr: break; case FMTLEN: { - int minlen = va_arg(args, int); - int leftjust = 0; + int minlen = va_arg(args, int); + int leftjust = 0; if (minlen < 0) { @@ -563,10 +563,10 @@ performpr: break; case FMTFLOAT: fmtfloat(fmtparptr[i]->fvalue, fmtparptr[i]->type, - fmtparptr[i]->forcesign, fmtparptr[i]->leftjust, - fmtparptr[i]->minlen, fmtparptr[i]->zpad, - fmtparptr[i]->precision, fmtparptr[i]->pointflag, - end, &output); + fmtparptr[i]->forcesign, fmtparptr[i]->leftjust, + fmtparptr[i]->minlen, fmtparptr[i]->zpad, + fmtparptr[i]->precision, fmtparptr[i]->pointflag, + end, &output); break; case FMTCHAR: dopr_outch(fmtparptr[i]->charvalue, end, &output); @@ -626,7 +626,7 @@ fmtint(int64 value, int base, int dosign, int forcesign, int leftjust, /* Handle +/- and %X (uppercase hex) */ if (dosign && adjust_sign((value < 0), forcesign, &signvalue)) - value = -value; + value = -value; if (base < 0) { caps = 1; @@ -645,7 +645,7 @@ fmtint(int64 value, int base, int dosign, int forcesign, int leftjust, adjust_padlen(minlen, vallen, leftjust, &padlen); leading_pad(zpad, &signvalue, &padlen, end, output); - + while (vallen > 0) dopr_outch(convert[--vallen], end, output); @@ -670,7 +670,7 @@ fmtfloat(double value, char type, int forcesign, int leftjust, sprintf(fmt, "%%%c", type); if (adjust_sign((value < 0), forcesign, &signvalue)) - value = -value; + value = -value; vallen = sprintf(convert, fmt, value); @@ -761,7 +761,7 @@ leading_pad(int zpad, int *signvalue, int *padlen, char *end, char **output) { dopr_outch(*signvalue, end, output); if (*padlen > 0) - --*padlen; + --* padlen; if (padlen < 0) ++padlen; } @@ -777,4 +777,3 @@ trailing_pad(int *padlen, char *end, char **output) ++*padlen; } } - diff --git a/src/port/sprompt.c b/src/port/sprompt.c index 3b97eea7ec..cb0c910afb 100644 --- a/src/port/sprompt.c +++ b/src/port/sprompt.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/sprompt.c,v 1.11 2005/02/22 04:43:16 momjian Exp $ + * $PostgreSQL: pgsql/src/port/sprompt.c,v 1.12 2005/10/15 02:49:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -46,7 +46,6 @@ simple_prompt(const char *prompt, int maxlen, bool echo) #ifdef HAVE_TERMIOS_H struct termios t_orig, t; - #else #ifdef WIN32 HANDLE t = NULL; @@ -61,8 +60,8 @@ simple_prompt(const char *prompt, int maxlen, bool echo) prompt_state = true; /* disable SIGINT */ /* - * Do not try to collapse these into one "w+" mode file. Doesn't work - * on some platforms (eg, HPUX 10.20). + * Do not try to collapse these into one "w+" mode file. Doesn't work on + * some platforms (eg, HPUX 10.20). */ termin = fopen("/dev/tty", "r"); termout = fopen("/dev/tty", "w"); diff --git a/src/port/strtol.c b/src/port/strtol.c index 6bf14c5ff6..a948489390 100644 --- a/src/port/strtol.c +++ b/src/port/strtol.c @@ -92,19 +92,18 @@ int base; /* * Compute the cutoff value between legal numbers and illegal numbers. - * That is the largest legal value, divided by the base. An input - * number that is greater than this value, if followed by a legal - * input character, is too big. One that is equal to this value may - * be valid or not; the limit between valid and invalid numbers is - * then based on the last digit. For instance, if the range for longs - * is [-2147483648..2147483647] and the input base is 10, cutoff will - * be set to 214748364 and cutlim to either 7 (neg==0) or 8 (neg==1), - * meaning that if we have accumulated a value > 214748364, or equal - * but the next digit is > 7 (or 8), the number is too big, and we - * will return a range error. + * That is the largest legal value, divided by the base. An input number + * that is greater than this value, if followed by a legal input + * character, is too big. One that is equal to this value may be valid or + * not; the limit between valid and invalid numbers is then based on the + * last digit. For instance, if the range for longs is + * [-2147483648..2147483647] and the input base is 10, cutoff will be set + * to 214748364 and cutlim to either 7 (neg==0) or 8 (neg==1), meaning + * that if we have accumulated a value > 214748364, or equal but the next + * digit is > 7 (or 8), the number is too big, and we will return a range + * error. * - * Set any if any `digits' consumed; make it negative to indicate - * overflow. + * Set any if any `digits' consumed; make it negative to indicate overflow. */ cutoff = neg ? -(unsigned long) LONG_MIN : LONG_MAX; cutlim = cutoff % (unsigned long) base; diff --git a/src/port/thread.c b/src/port/thread.c index bfdf1bd282..a067af20d1 100644 --- a/src/port/thread.c +++ b/src/port/thread.c @@ -7,7 +7,7 @@ * * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/port/thread.c,v 1.30 2005/07/28 04:03:14 tgl Exp $ + * $PostgreSQL: pgsql/src/port/thread.c,v 1.31 2005/10/15 02:49:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -135,12 +135,11 @@ pqGethostbyname(const char *name, #if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(HAVE_GETHOSTBYNAME_R) /* - * broken (well early POSIX draft) gethostbyname_r() which returns - * 'struct hostent *' + * broken (well early POSIX draft) gethostbyname_r() which returns 'struct + * hostent *' */ *result = gethostbyname_r(name, resultbuf, buffer, buflen, herrno); return (*result == NULL) ? -1 : 0; - #else /* no gethostbyname_r(), just use gethostbyname() */ diff --git a/src/port/unsetenv.c b/src/port/unsetenv.c index bc1c21effa..6509ff79f3 100644 --- a/src/port/unsetenv.c +++ b/src/port/unsetenv.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/unsetenv.c,v 1.4 2004/12/31 22:03:53 pgsql Exp $ + * $PostgreSQL: pgsql/src/port/unsetenv.c,v 1.5 2005/10/15 02:49:51 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -25,17 +25,16 @@ unsetenv(const char *name) return; /* no work */ /* - * The technique embodied here works if libc follows the Single Unix - * Spec and actually uses the storage passed to putenv() to hold the - * environ entry. When we clobber the entry in the second step we are - * ensuring that we zap the actual environ member. However, there are - * some libc implementations (notably recent BSDs) that do not obey - * SUS but copy the presented string. This method fails on such - * platforms. Hopefully all such platforms have unsetenv() and thus - * won't be using this hack. + * The technique embodied here works if libc follows the Single Unix Spec + * and actually uses the storage passed to putenv() to hold the environ + * entry. When we clobber the entry in the second step we are ensuring + * that we zap the actual environ member. However, there are some libc + * implementations (notably recent BSDs) that do not obey SUS but copy the + * presented string. This method fails on such platforms. Hopefully all + * such platforms have unsetenv() and thus won't be using this hack. * - * Note that repeatedly setting and unsetting a var using this code will - * leak memory. + * Note that repeatedly setting and unsetting a var using this code will leak + * memory. */ envstr = (char *) malloc(strlen(name) + 2); @@ -50,8 +49,8 @@ unsetenv(const char *name) strcpy(envstr, "="); /* - * This last putenv cleans up if we have multiple zero-length names as - * a result of unsetting multiple things. + * This last putenv cleans up if we have multiple zero-length names as a + * result of unsetting multiple things. */ putenv(envstr); } |
