mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
pgindent run before 6.3 release, with Thomas' requested changes.
This commit is contained in:
@@ -72,10 +72,10 @@ static int readExports(ModulePtr);
|
||||
static void terminate(void);
|
||||
static void *findMain(void);
|
||||
|
||||
void *
|
||||
void *
|
||||
dlopen(const char *path, int mode)
|
||||
{
|
||||
ModulePtr mp;
|
||||
ModulePtr mp;
|
||||
static void *mainModule;
|
||||
|
||||
/*
|
||||
@@ -168,7 +168,7 @@ dlopen(const char *path, int mode)
|
||||
*/
|
||||
if (mode & RTLD_GLOBAL)
|
||||
{
|
||||
ModulePtr mp1;
|
||||
ModulePtr mp1;
|
||||
|
||||
for (mp1 = mp->next; mp1; mp1 = mp1->next)
|
||||
if (loadbind(0, mp1->entry, mp->entry) == -1)
|
||||
@@ -221,7 +221,7 @@ dlopen(const char *path, int mode)
|
||||
static void
|
||||
caterr(char *s)
|
||||
{
|
||||
char *p = s;
|
||||
char *p = s;
|
||||
|
||||
while (*p >= '0' && *p <= '9')
|
||||
p++;
|
||||
@@ -255,12 +255,12 @@ caterr(char *s)
|
||||
}
|
||||
}
|
||||
|
||||
void *
|
||||
void *
|
||||
dlsym(void *handle, const char *symbol)
|
||||
{
|
||||
ModulePtr mp = (ModulePtr) handle;
|
||||
ExportPtr ep;
|
||||
int i;
|
||||
ModulePtr mp = (ModulePtr) handle;
|
||||
ExportPtr ep;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Could speed up the search, but I assume that one assigns the result
|
||||
@@ -275,7 +275,7 @@ dlsym(void *handle, const char *symbol)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char *
|
||||
char *
|
||||
dlerror(void)
|
||||
{
|
||||
if (errvalid)
|
||||
@@ -289,9 +289,9 @@ dlerror(void)
|
||||
int
|
||||
dlclose(void *handle)
|
||||
{
|
||||
ModulePtr mp = (ModulePtr) handle;
|
||||
ModulePtr mp = (ModulePtr) handle;
|
||||
int result;
|
||||
ModulePtr mp1;
|
||||
ModulePtr mp1;
|
||||
|
||||
if (--mp->refCnt > 0)
|
||||
return 0;
|
||||
@@ -311,8 +311,8 @@ dlclose(void *handle)
|
||||
}
|
||||
if (mp->exports)
|
||||
{
|
||||
ExportPtr ep;
|
||||
int i;
|
||||
ExportPtr ep;
|
||||
int i;
|
||||
|
||||
for (ep = mp->exports, i = mp->nExports; i; i--, ep++)
|
||||
if (ep->name)
|
||||
@@ -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+1);
|
||||
StrNCpy(tmpsym, ls->l_name, SYMNMLEN + 1);
|
||||
symname = tmpsym;
|
||||
}
|
||||
ep->name = strdup(symname);
|
||||
|
@@ -48,7 +48,7 @@ static char sccsid[] = "@(#)dl.c 5.4 (Berkeley) 2/23/91";
|
||||
|
||||
static char error_message[BUFSIZ];
|
||||
|
||||
char *
|
||||
char *
|
||||
BSD44_derived_dlerror(void)
|
||||
{
|
||||
static char ret[BUFSIZ];
|
||||
@@ -58,7 +58,7 @@ BSD44_derived_dlerror(void)
|
||||
return ((ret[0] == 0) ? (char *) NULL : ret);
|
||||
}
|
||||
|
||||
void *
|
||||
void *
|
||||
BSD44_derived_dlopen(const char *file, int num)
|
||||
{
|
||||
#if defined(__mips__) || (defined(__NetBSD__) && defined(vax))
|
||||
@@ -75,7 +75,7 @@ BSD44_derived_dlopen(const char *file, int num)
|
||||
#endif
|
||||
}
|
||||
|
||||
void *
|
||||
void *
|
||||
BSD44_derived_dlsym(void *handle, const char *name)
|
||||
{
|
||||
#if defined(__mips__) || (defined(__NetBSD__) && defined(vax))
|
||||
|
@@ -24,7 +24,7 @@
|
||||
|
||||
extern char pg_pathname[];
|
||||
|
||||
void *
|
||||
void *
|
||||
pg_dlopen(char *filename)
|
||||
{
|
||||
static int dl_initialized = 0;
|
||||
@@ -97,7 +97,7 @@ pg_dlopen(char *filename)
|
||||
return (void *) strdup(filename);
|
||||
}
|
||||
|
||||
char *
|
||||
char *
|
||||
pg_dlerror()
|
||||
{
|
||||
return dld_strerror(dld_errno);
|
||||
|
@@ -2,6 +2,5 @@
|
||||
*
|
||||
* see dgux.h
|
||||
*
|
||||
* $Id: dgux.c,v 1.2 1998/02/14 19:56:19 scrappy Exp $
|
||||
* $Id: dgux.c,v 1.3 1998/02/26 04:34:24 momjian Exp $
|
||||
*/
|
||||
|
||||
|
@@ -1,10 +1,10 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* dgux.h--
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: dgux.h,v 1.2 1998/02/14 19:56:21 scrappy Exp $
|
||||
* $Id: dgux.h,v 1.3 1998/02/26 04:34:25 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
|
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/hpux.c,v 1.2 1998/02/02 00:10:10 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/hpux.c,v 1.3 1998/02/26 04:34:26 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* all functions are defined here -- it's impossible to trace the
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "utils/dynamic_loader.h"
|
||||
#include "dynloader.h"
|
||||
|
||||
void *
|
||||
void *
|
||||
pg_dlopen(char *filename)
|
||||
{
|
||||
shl_t handle = shl_load(filename, BIND_DEFERRED, 0);
|
||||
@@ -50,7 +50,7 @@ pg_dlclose(void *handle)
|
||||
shl_unload((shl_t) handle);
|
||||
}
|
||||
|
||||
char *
|
||||
char *
|
||||
pg_dlerror()
|
||||
{
|
||||
static char errmsg[] = "shl_load failed";
|
||||
|
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/linux.c,v 1.6 1998/01/07 21:04:23 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/linux.c,v 1.7 1998/02/26 04:34:27 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -28,7 +28,7 @@
|
||||
#if FALSE
|
||||
extern char pg_pathname[];
|
||||
|
||||
void *
|
||||
void *
|
||||
pg_dlopen(char *filename)
|
||||
{
|
||||
#ifndef HAVE_DLD_H
|
||||
@@ -106,7 +106,7 @@ pg_dlopen(char *filename)
|
||||
#endif
|
||||
}
|
||||
|
||||
char *
|
||||
char *
|
||||
pg_dlerror()
|
||||
{
|
||||
#ifndef HAVE_DLD_H
|
||||
@@ -115,4 +115,5 @@ pg_dlerror()
|
||||
return dld_strerror(dld_errno);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -6,7 +6,7 @@
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: linux.h,v 1.2 1998/01/01 06:02:04 thomas Exp $
|
||||
* $Id: linux.h,v 1.3 1998/02/26 04:34:28 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -39,4 +39,4 @@
|
||||
|
||||
/* port.c */
|
||||
|
||||
#endif /* PORT_PROTOS_H */
|
||||
#endif /* PORT_PROTOS_H */
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* Dummy file used for nothing at this point
|
||||
*
|
||||
* see univel.h
|
||||
*/
|
||||
/* Dummy file used for nothing at this point
|
||||
*
|
||||
* see univel.h
|
||||
*/
|
||||
|
@@ -1,15 +1,15 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* port-protos.h--
|
||||
* port-specific prototypes for Intel x86/UNIXWARE
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* port-protos.h,v 1.2 1995/03/17 06:40:18 andrew Exp
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* port-protos.h--
|
||||
* port-specific prototypes for Intel x86/UNIXWARE
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* port-protos.h,v 1.2 1995/03/17 06:40:18 andrew Exp
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef PORT_PROTOS_H
|
||||
#define PORT_PROTOS_H
|
||||
|
||||
@@ -17,18 +17,18 @@
|
||||
#include "fmgr.h" /* for func_ptr */
|
||||
#include "utils/dynamic_loader.h"
|
||||
|
||||
/* dynloader.c */
|
||||
/*
|
||||
* Dynamic Loader on Intel x86/Intel SVR4.
|
||||
*
|
||||
* this dynamic loader uses the system dynamic loading interface for shared
|
||||
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
|
||||
* library as the file to be dynamically loaded.
|
||||
*
|
||||
*/
|
||||
/* dynloader.c */
|
||||
/*
|
||||
* Dynamic Loader on Intel x86/Intel SVR4.
|
||||
*
|
||||
* this dynamic loader uses the system dynamic loading interface for shared
|
||||
* libraries (ie. dlopen/dlsym/dlclose). The user must specify a shared
|
||||
* library as the file to be dynamically loaded.
|
||||
*
|
||||
*/
|
||||
#define pg_dlopen(f) dlopen(f,RTLD_LAZY)
|
||||
#define pg_dlsym dlsym
|
||||
#define pg_dlclose dlclose
|
||||
#define pg_dlerror dlerror
|
||||
|
||||
#endif /* PORT_PROTOS_H */
|
||||
#endif /* PORT_PROTOS_H */
|
||||
|
@@ -1,20 +1,21 @@
|
||||
/* $Id: getrusage.c,v 1.6 1998/02/24 03:45:06 scrappy Exp $ */
|
||||
/* $Id: getrusage.c,v 1.7 1998/02/26 04:34:00 momjian Exp $ */
|
||||
|
||||
#include <math.h> /* for pow() prototype */
|
||||
#include <math.h> /* for pow() prototype */
|
||||
|
||||
#include <errno.h>
|
||||
#include "rusagestub.h"
|
||||
|
||||
#if 0 /* this is from univel port ... how does compiler define? */
|
||||
/* same for i386_solaris port ... how does compiler define? */
|
||||
/* same for sco port ... how does compiler define? */
|
||||
/* same for sparc_solaris port ... how does compiler define? */
|
||||
/* same for svr4 port ... how does compiler define? */
|
||||
#if 0 /* this is from univel port ... how does
|
||||
* compiler define? */
|
||||
/* same for i386_solaris port ... how does compiler define? */
|
||||
/* same for sco port ... how does compiler define? */
|
||||
/* same for sparc_solaris port ... how does compiler define? */
|
||||
/* same for svr4 port ... how does compiler define? */
|
||||
int
|
||||
getrusage(int who, struct rusage * rusage)
|
||||
{
|
||||
struct tms tms;
|
||||
int tick_rate = CLK_TCK; /* ticks per second */
|
||||
int tick_rate = CLK_TCK; /* ticks per second */
|
||||
clock_t u,
|
||||
s;
|
||||
|
||||
@@ -50,11 +51,14 @@ getrusage(int who, struct rusage * rusage)
|
||||
rusage->ru_stime.tv_usec = TICK_TO_USEC(u, tick_rate);
|
||||
return (0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if 0 /* this is for hpux port ... how does compiler define? */
|
||||
#if 0 /* this is for hpux port ... how does
|
||||
* compiler define? */
|
||||
getrusage(int who, struct rusage * ru)
|
||||
{
|
||||
return (syscall(SYS_GETRUSAGE, who, ru));
|
||||
return (syscall(SYS_GETRUSAGE, who, ru));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/* $Id: inet_aton.c,v 1.13 1998/02/11 19:11:05 momjian Exp $
|
||||
/* $Id: inet_aton.c,v 1.14 1998/02/26 04:34:04 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
|
||||
@@ -57,11 +57,11 @@ int
|
||||
inet_aton(const char *cp, struct in_addr * addr)
|
||||
{
|
||||
unsigned int val;
|
||||
int base,
|
||||
int base,
|
||||
n;
|
||||
char c;
|
||||
char c;
|
||||
u_int parts[4];
|
||||
u_int *pp = parts;
|
||||
u_int *pp = parts;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
@@ -1,3 +1,3 @@
|
||||
/* $Id: inet_aton.h,v 1.6 1997/12/19 13:34:29 scrappy Exp $ */
|
||||
/* $Id: inet_aton.h,v 1.7 1998/02/26 04:34:08 momjian Exp $ */
|
||||
|
||||
int inet_aton(const char *cp, struct in_addr * addr);
|
||||
int inet_aton(const char *cp, struct in_addr * addr);
|
||||
|
@@ -1,16 +1,16 @@
|
||||
/* $Id: isinf.c,v 1.3 1998/02/17 02:00:12 scrappy Exp $ */
|
||||
/* $Id: isinf.c,v 1.4 1998/02/26 04:34:10 momjian Exp $ */
|
||||
|
||||
#include <math.h>
|
||||
#include <math.h>
|
||||
#include "config.h"
|
||||
|
||||
#if HAVE_FPCLASS
|
||||
# if HAVE_IEEEFP_H
|
||||
# include <ieeefp.h>
|
||||
# endif
|
||||
#if HAVE_IEEEFP_H
|
||||
#include <ieeefp.h>
|
||||
#endif
|
||||
int
|
||||
isinf(double d)
|
||||
{
|
||||
fpclass_t type = fpclass(d);
|
||||
fpclass_t type = fpclass(d);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
@@ -24,36 +24,40 @@ isinf(double d)
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
# if defined(HAVE_FP_CLASS) || defined(HAVE_FP_CLASS_D)
|
||||
# if HAVE_FP_CLASS_H
|
||||
# include <fp_class.h>
|
||||
# endif
|
||||
int
|
||||
isinf(x)
|
||||
double x;
|
||||
{
|
||||
# if HAVE_FP_CLASS
|
||||
int fpclass = fp_class(x);
|
||||
# else
|
||||
int fpclass = fp_class_d(x);
|
||||
# endif
|
||||
|
||||
if (fpclass == FP_POS_INF)
|
||||
return (1);
|
||||
#if defined(HAVE_FP_CLASS) || defined(HAVE_FP_CLASS_D)
|
||||
#if HAVE_FP_CLASS_H
|
||||
#include <fp_class.h>
|
||||
#endif
|
||||
int
|
||||
isinf(x)
|
||||
double x;
|
||||
{
|
||||
#if HAVE_FP_CLASS
|
||||
int fpclass = fp_class(x);
|
||||
|
||||
#else
|
||||
int fpclass = fp_class_d(x);
|
||||
|
||||
#endif
|
||||
|
||||
if (fpclass == FP_POS_INF)
|
||||
return (1);
|
||||
if (fpclass == FP_NEG_INF)
|
||||
return (-1);
|
||||
return (0);
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_CLASS)
|
||||
int
|
||||
isinf(double x)
|
||||
{
|
||||
int fpclass = class(x);
|
||||
int fpclass = class(x);
|
||||
|
||||
if (fpclass == FP_PLUS_INF)
|
||||
return (1);
|
||||
@@ -61,4 +65,5 @@ isinf(double x)
|
||||
return (-1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -31,7 +31,7 @@ TransferError(NXStream * s)
|
||||
strcpy(lastError, buffer);
|
||||
}
|
||||
|
||||
void *
|
||||
void *
|
||||
next_dlopen(char *name)
|
||||
{
|
||||
int rld_success;
|
||||
@@ -60,7 +60,7 @@ next_dlclose(void *handle)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void *
|
||||
void *
|
||||
next_dlsym(void *handle, char *symbol)
|
||||
{
|
||||
NXStream *errorStream = OpenError();
|
||||
@@ -74,7 +74,7 @@ next_dlsym(void *handle, char *symbol)
|
||||
return (void *) symref;
|
||||
}
|
||||
|
||||
char *
|
||||
char *
|
||||
next_dlerror(void)
|
||||
{
|
||||
return lastError;
|
||||
|
@@ -50,7 +50,7 @@ sigemptyset(int *set)
|
||||
return (*set = 0);
|
||||
}
|
||||
|
||||
char *
|
||||
char *
|
||||
getcwd(char *buf, size_t size)
|
||||
{
|
||||
return getwd(buf);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/* $Id: random.c,v 1.3 1998/02/24 03:45:07 scrappy Exp $ */
|
||||
/* $Id: random.c,v 1.4 1998/02/26 04:34:11 momjian Exp $ */
|
||||
|
||||
#include <math.h> /* for pow() prototype */
|
||||
#include <math.h> /* for pow() prototype */
|
||||
|
||||
#include <errno.h>
|
||||
#include "rusagestub.h"
|
||||
@@ -10,4 +10,3 @@ random()
|
||||
{
|
||||
return (lrand48());
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/* $Id: srandom.c,v 1.4 1998/02/24 03:45:07 scrappy Exp $ */
|
||||
/* $Id: srandom.c,v 1.5 1998/02/26 04:34:14 momjian Exp $ */
|
||||
|
||||
#include <math.h> /* for pow() prototype */
|
||||
#include <math.h> /* for pow() prototype */
|
||||
|
||||
#include <errno.h>
|
||||
#include "rusagestub.h"
|
||||
@@ -10,4 +10,3 @@ srandom(unsigned int seed)
|
||||
{
|
||||
srand48((long int) seed);
|
||||
}
|
||||
|
||||
|
@@ -53,13 +53,13 @@ long
|
||||
strtol(nptr, endptr, base)
|
||||
const char *nptr;
|
||||
char **endptr;
|
||||
int base;
|
||||
int base;
|
||||
{
|
||||
const char *s = nptr;
|
||||
unsigned long acc;
|
||||
int c;
|
||||
int c;
|
||||
unsigned long cutoff;
|
||||
int neg = 0,
|
||||
int neg = 0,
|
||||
any,
|
||||
cutlim;
|
||||
|
||||
|
@@ -6,22 +6,22 @@
|
||||
* 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. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. 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)
|
||||
@@ -33,7 +33,8 @@
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char sccsid[] = "@(#)strtoul.c 8.1 (Berkeley) 6/4/93";
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
@@ -48,38 +49,45 @@ static char sccsid[] = "@(#)strtoul.c 8.1 (Berkeley) 6/4/93";
|
||||
*/
|
||||
unsigned long
|
||||
strtoul(nptr, endptr, base)
|
||||
const char *nptr;
|
||||
char **endptr;
|
||||
register int base;
|
||||
const char *nptr;
|
||||
char **endptr;
|
||||
register int base;
|
||||
{
|
||||
register const char *s = nptr;
|
||||
register unsigned long acc;
|
||||
register unsigned char c;
|
||||
register unsigned long cutoff;
|
||||
register int neg = 0, any, cutlim;
|
||||
register int neg = 0,
|
||||
any,
|
||||
cutlim;
|
||||
|
||||
/*
|
||||
* See strtol for comments as to the logic used.
|
||||
*/
|
||||
do {
|
||||
do
|
||||
{
|
||||
c = *s++;
|
||||
} while (isspace(c));
|
||||
if (c == '-') {
|
||||
if (c == '-')
|
||||
{
|
||||
neg = 1;
|
||||
c = *s++;
|
||||
} else if (c == '+')
|
||||
}
|
||||
else if (c == '+')
|
||||
c = *s++;
|
||||
if ((base == 0 || base == 16) &&
|
||||
c == '0' && (*s == 'x' || *s == 'X')) {
|
||||
c == '0' && (*s == 'x' || *s == 'X'))
|
||||
{
|
||||
c = s[1];
|
||||
s += 2;
|
||||
base = 16;
|
||||
}
|
||||
if (base == 0)
|
||||
base = c == '0' ? 8 : 10;
|
||||
cutoff = (unsigned long)ULONG_MAX / (unsigned long)base;
|
||||
cutlim = (unsigned long)ULONG_MAX % (unsigned long)base;
|
||||
for (acc = 0, any = 0;; c = *s++) {
|
||||
cutoff = (unsigned long) ULONG_MAX / (unsigned long) base;
|
||||
cutlim = (unsigned long) ULONG_MAX % (unsigned long) base;
|
||||
for (acc = 0, any = 0;; c = *s++)
|
||||
{
|
||||
if (!isascii(c))
|
||||
break;
|
||||
if (isdigit(c))
|
||||
@@ -92,18 +100,21 @@ strtoul(nptr, endptr, base)
|
||||
break;
|
||||
if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
|
||||
any = -1;
|
||||
else {
|
||||
else
|
||||
{
|
||||
any = 1;
|
||||
acc *= base;
|
||||
acc += c;
|
||||
}
|
||||
}
|
||||
if (any < 0) {
|
||||
if (any < 0)
|
||||
{
|
||||
acc = ULONG_MAX;
|
||||
errno = ERANGE;
|
||||
} else if (neg)
|
||||
}
|
||||
else if (neg)
|
||||
acc = -acc;
|
||||
if (endptr != 0)
|
||||
*endptr = (char *)(any ? s - 1 : nptr);
|
||||
*endptr = (char *) (any ? s - 1 : nptr);
|
||||
return (acc);
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/port/ultrix4/Attic/dynloader.c,v 1.5 1997/09/08 02:27:34 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/port/ultrix4/Attic/dynloader.c,v 1.6 1998/02/26 04:34:39 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
extern char pg_pathname[];
|
||||
|
||||
void *
|
||||
void *
|
||||
pg_dlopen(char *filename)
|
||||
{
|
||||
static int dl_initialized = 0;
|
||||
|
Reference in New Issue
Block a user