mirror of
https://github.com/postgres/postgres.git
synced 2025-08-28 18:48:04 +03:00
Standard pgindent run for 8.1.
This commit is contained in:
@@ -84,8 +84,8 @@ dlopen(const char *path, int mode)
|
||||
static void *mainModule;
|
||||
|
||||
/*
|
||||
* Upon the first call register a terminate handler that will close
|
||||
* all libraries. Also get a reference to the main module for use with
|
||||
* Upon the first call register a terminate handler that will close all
|
||||
* libraries. Also get a reference to the main module for use with
|
||||
* loadbind.
|
||||
*/
|
||||
if (!mainModule)
|
||||
@@ -121,8 +121,8 @@ dlopen(const char *path, int mode)
|
||||
}
|
||||
|
||||
/*
|
||||
* load should be declared load(const char *...). Thus we cast the
|
||||
* path to a normal char *. Ugly.
|
||||
* load should be declared load(const char *...). Thus we cast the path to
|
||||
* a normal char *. Ugly.
|
||||
*/
|
||||
if ((mp->entry = (void *) load((char *) path, L_NOAUTODEFER, NULL)) == NULL)
|
||||
{
|
||||
@@ -134,8 +134,8 @@ dlopen(const char *path, int mode)
|
||||
strcat(errbuf, ": ");
|
||||
|
||||
/*
|
||||
* If AIX says the file is not executable, the error can be
|
||||
* further described by querying the loader about the last error.
|
||||
* If AIX says the file is not executable, the error can be further
|
||||
* described by querying the loader about the last error.
|
||||
*/
|
||||
if (errno == ENOEXEC)
|
||||
{
|
||||
@@ -203,8 +203,8 @@ dlopen(const char *path, int mode)
|
||||
errvalid = 0;
|
||||
|
||||
/*
|
||||
* If the shared object was compiled using xlC we will need to call
|
||||
* static constructors (and later on dlclose destructors).
|
||||
* If the shared object was compiled using xlC we will need to call static
|
||||
* constructors (and later on dlclose destructors).
|
||||
*/
|
||||
if (mp->cdtors = (CdtorPtr) dlsym(mp, "__cdtors"))
|
||||
{
|
||||
@@ -268,8 +268,8 @@ dlsym(void *handle, const char *symbol)
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Could speed up the search, but I assume that one assigns the result
|
||||
* to function pointers anyways.
|
||||
* Could speed up the search, but I assume that one assigns the result to
|
||||
* function pointers anyways.
|
||||
*/
|
||||
for (ep = mp->exports, i = mp->nExports; i; i--, ep++)
|
||||
if (strcmp(ep->name, symbol) == 0)
|
||||
@@ -377,8 +377,8 @@ readExports(ModulePtr mp)
|
||||
}
|
||||
|
||||
/*
|
||||
* The module might be loaded due to the LIBPATH environment
|
||||
* variable. Search for the loaded module using L_GETINFO.
|
||||
* The module might be loaded due to the LIBPATH environment variable.
|
||||
* Search for the loaded module using L_GETINFO.
|
||||
*/
|
||||
if ((buf = malloc(size)) == NULL)
|
||||
{
|
||||
@@ -409,8 +409,8 @@ readExports(ModulePtr mp)
|
||||
}
|
||||
|
||||
/*
|
||||
* Traverse the list of loaded modules. The entry point returned
|
||||
* by load() does actually point to the data segment origin.
|
||||
* Traverse the list of loaded modules. The entry point returned by
|
||||
* load() does actually point to the data segment origin.
|
||||
*/
|
||||
lp = (struct ld_info *) buf;
|
||||
while (lp)
|
||||
@@ -445,8 +445,8 @@ readExports(ModulePtr mp)
|
||||
|
||||
/*
|
||||
* Get the padding for the data section. This is needed for AIX 4.1
|
||||
* compilers. This is used when building the final function pointer to
|
||||
* the exported symbol.
|
||||
* compilers. This is used when building the final function pointer to the
|
||||
* exported symbol.
|
||||
*/
|
||||
if (ldnshread(ldp, _DATA, &shdata) != SUCCESS)
|
||||
{
|
||||
@@ -466,8 +466,8 @@ readExports(ModulePtr mp)
|
||||
}
|
||||
|
||||
/*
|
||||
* We read the complete loader section in one chunk, this makes
|
||||
* finding long symbol names residing in the string table easier.
|
||||
* We read the complete loader section in one chunk, this makes finding
|
||||
* long symbol names residing in the string table easier.
|
||||
*/
|
||||
if ((ldbuf = (char *) malloc(sh.s_size)) == NULL)
|
||||
{
|
||||
@@ -520,8 +520,8 @@ readExports(ModulePtr mp)
|
||||
}
|
||||
|
||||
/*
|
||||
* Fill in the export table. All entries are relative to the entry
|
||||
* point we got from load.
|
||||
* Fill in the export table. All entries are relative to the entry point
|
||||
* we got from load.
|
||||
*/
|
||||
ep = mp->exports;
|
||||
ls = (LDSYM *) (ldbuf + LDHDRSZ);
|
||||
@@ -538,8 +538,8 @@ readExports(ModulePtr mp)
|
||||
{
|
||||
/*
|
||||
* The l_name member is not zero terminated, we must copy the
|
||||
* first SYMNMLEN chars and make sure we have a zero byte at
|
||||
* the end.
|
||||
* first SYMNMLEN chars and make sure we have a zero byte at the
|
||||
* end.
|
||||
*/
|
||||
strncpy(tmpsym, ls->l_name, SYMNMLEN);
|
||||
tmpsym[SYMNMLEN] = '\0';
|
||||
@@ -598,8 +598,8 @@ findMain(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* The first entry is the main module. The entry point returned by
|
||||
* load() does actually point to the data segment origin.
|
||||
* The first entry is the main module. The entry point returned by load()
|
||||
* does actually point to the data segment origin.
|
||||
*/
|
||||
lp = (struct ld_info *) buf;
|
||||
ret = lp->ldinfo_dataorg;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $PostgreSQL: pgsql/src/backend/port/dynloader/aix.h,v 1.12 2003/11/29 22:39:51 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/port/dynloader/aix.h,v 1.13 2005/10/15 02:49:23 momjian Exp $
|
||||
*
|
||||
* @(#)dlfcn.h 1.4 revision of 95/04/25 09:36:52
|
||||
* This is an unpublished work copyright (c) 1992 HELIOS Software GmbH
|
||||
@@ -12,7 +12,6 @@
|
||||
#ifdef HAVE_DLOPEN
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
#else /* HAVE_DLOPEN */
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -42,7 +41,6 @@ void *dlopen(const char *path, int mode);
|
||||
void *dlsym(void *handle, const char *symbol);
|
||||
char *dlerror(void);
|
||||
int dlclose(void *handle);
|
||||
|
||||
#else
|
||||
void *dlopen();
|
||||
void *dlsym();
|
||||
|
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/port/dynloader/bsdi.c,v 1.26 2004/12/31 22:00:32 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/port/dynloader/bsdi.c,v 1.27 2005/10/15 02:49:23 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -26,8 +26,8 @@ pg_dlopen(char *filename)
|
||||
static int dl_initialized = 0;
|
||||
|
||||
/*
|
||||
* initializes the dynamic loader with the executable's pathname.
|
||||
* (only needs to do this the first time pg_dlopen is called.)
|
||||
* initializes the dynamic loader with the executable's pathname. (only
|
||||
* needs to do this the first time pg_dlopen is called.)
|
||||
*/
|
||||
if (!dl_initialized)
|
||||
{
|
||||
@@ -48,9 +48,8 @@ pg_dlopen(char *filename)
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* If undefined symbols: try to link with the C and math libraries!
|
||||
* This could be smarter, if the dynamic linker was able to handle
|
||||
* shared libs!
|
||||
* If undefined symbols: try to link with the C and math libraries! This
|
||||
* could be smarter, if the dynamic linker was able to handle shared libs!
|
||||
*/
|
||||
if (dld_undefined_sym_count > 0)
|
||||
{
|
||||
|
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/port/dynloader/bsdi.h,v 1.21 2004/12/31 22:00:32 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/port/dynloader/bsdi.h,v 1.22 2005/10/15 02:49:23 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -37,7 +37,6 @@
|
||||
#define pg_dlsym dlsym
|
||||
#define pg_dlclose dlclose
|
||||
#define pg_dlerror dlerror
|
||||
|
||||
#else /* not HAVE_DLOPEN */
|
||||
|
||||
#define pg_dlsym(handle, funcname) ((PGFunction) dld_get_func((funcname)))
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/port/dynloader/hpux.c,v 1.27 2004/12/31 22:00:32 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/port/dynloader/hpux.c,v 1.28 2005/10/15 02:49:23 momjian Exp $
|
||||
*
|
||||
* NOTES
|
||||
* all functions are defined here -- it's impossible to trace the
|
||||
@@ -34,7 +34,7 @@ pg_dlopen(char *filename)
|
||||
* call the library!
|
||||
*/
|
||||
shl_t handle = shl_load(filename,
|
||||
BIND_IMMEDIATE | BIND_VERBOSE | DYNAMIC_PATH,
|
||||
BIND_IMMEDIATE | BIND_VERBOSE | DYNAMIC_PATH,
|
||||
0L);
|
||||
|
||||
return (void *) handle;
|
||||
|
@@ -11,7 +11,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/port/dynloader/linux.c,v 1.30 2004/12/31 22:00:32 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/port/dynloader/linux.c,v 1.31 2005/10/15 02:49:23 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -38,8 +38,8 @@ pg_dlopen(char *filename)
|
||||
static int dl_initialized = 0;
|
||||
|
||||
/*
|
||||
* initializes the dynamic loader with the executable's pathname.
|
||||
* (only needs to do this the first time pg_dlopen is called.)
|
||||
* initializes the dynamic loader with the executable's pathname. (only
|
||||
* needs to do this the first time pg_dlopen is called.)
|
||||
*/
|
||||
if (!dl_initialized)
|
||||
{
|
||||
@@ -60,9 +60,8 @@ pg_dlopen(char *filename)
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* If undefined symbols: try to link with the C and math libraries!
|
||||
* This could be smarter, if the dynamic linker was able to handle
|
||||
* shared libs!
|
||||
* If undefined symbols: try to link with the C and math libraries! This
|
||||
* could be smarter, if the dynamic linker was able to handle shared libs!
|
||||
*/
|
||||
if (dld_undefined_sym_count > 0)
|
||||
{
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/port/dynloader/ultrix4.c,v 1.22 2004/12/31 22:00:32 pgsql Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/port/dynloader/ultrix4.c,v 1.23 2005/10/15 02:49:23 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -26,8 +26,8 @@ pg_dlopen(char *filename)
|
||||
void *handle;
|
||||
|
||||
/*
|
||||
* initializes the dynamic loader with the executable's pathname.
|
||||
* (only needs to do this the first time pg_dlopen is called.)
|
||||
* initializes the dynamic loader with the executable's pathname. (only
|
||||
* needs to do this the first time pg_dlopen is called.)
|
||||
*/
|
||||
if (!dl_initialized)
|
||||
{
|
||||
@@ -43,8 +43,8 @@ pg_dlopen(char *filename)
|
||||
}
|
||||
|
||||
/*
|
||||
* open the file. We do the symbol resolution right away so that we
|
||||
* will know if there are undefined symbols. (This is in fact the same
|
||||
* open the file. We do the symbol resolution right away so that we will
|
||||
* know if there are undefined symbols. (This is in fact the same
|
||||
* semantics as "ld -A". ie. you cannot have undefined symbols.
|
||||
*/
|
||||
if ((handle = dl_open(filename, DL_NOW)) == NULL)
|
||||
|
@@ -1,31 +1,32 @@
|
||||
/* $PostgreSQL: pgsql/src/backend/port/dynloader/win32.c,v 1.6 2005/08/12 21:23:10 momjian Exp $ */
|
||||
/* $PostgreSQL: pgsql/src/backend/port/dynloader/win32.c,v 1.7 2005/10/15 02:49:23 momjian Exp $ */
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
|
||||
char *dlerror(void);
|
||||
int dlclose(void *handle);
|
||||
void *dlsym(void *handle, const char *symbol);
|
||||
void *dlopen(const char *path, int mode);
|
||||
char *dlerror(void);
|
||||
int dlclose(void *handle);
|
||||
void *dlsym(void *handle, const char *symbol);
|
||||
void *dlopen(const char *path, int mode);
|
||||
|
||||
static char last_dyn_error[512];
|
||||
|
||||
static void set_dl_error(void)
|
||||
static void
|
||||
set_dl_error(void)
|
||||
{
|
||||
DWORD err = GetLastError();
|
||||
DWORD err = GetLastError();
|
||||
|
||||
if (FormatMessage(FORMAT_MESSAGE_IGNORE_INSERTS |
|
||||
FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
err,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
last_dyn_error,
|
||||
sizeof(last_dyn_error)-1,
|
||||
NULL) == 0)
|
||||
FORMAT_MESSAGE_FROM_SYSTEM,
|
||||
NULL,
|
||||
err,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
last_dyn_error,
|
||||
sizeof(last_dyn_error) - 1,
|
||||
NULL) == 0)
|
||||
{
|
||||
snprintf(last_dyn_error, sizeof(last_dyn_error)-1,
|
||||
"unknown error %lu", err);
|
||||
}
|
||||
snprintf(last_dyn_error, sizeof(last_dyn_error) - 1,
|
||||
"unknown error %lu", err);
|
||||
}
|
||||
}
|
||||
|
||||
char *
|
||||
@@ -52,9 +53,10 @@ dlclose(void *handle)
|
||||
void *
|
||||
dlsym(void *handle, const char *symbol)
|
||||
{
|
||||
void *ptr;
|
||||
void *ptr;
|
||||
|
||||
ptr = GetProcAddress((HMODULE) handle, symbol);
|
||||
if (!ptr)
|
||||
if (!ptr)
|
||||
{
|
||||
set_dl_error();
|
||||
return NULL;
|
||||
@@ -66,15 +68,15 @@ dlsym(void *handle, const char *symbol)
|
||||
void *
|
||||
dlopen(const char *path, int mode)
|
||||
{
|
||||
HMODULE h;
|
||||
int prevmode;
|
||||
HMODULE h;
|
||||
int prevmode;
|
||||
|
||||
/* Disable popup error messages when loading DLLs */
|
||||
prevmode = SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
|
||||
h = LoadLibrary(path);
|
||||
SetErrorMode(prevmode);
|
||||
|
||||
if (!h)
|
||||
|
||||
if (!h)
|
||||
{
|
||||
set_dl_error();
|
||||
return NULL;
|
||||
|
Reference in New Issue
Block a user