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/backend/port/dynloader | |
parent | 790c01d28099587bbe2c623d4389b62ee49b1dee (diff) | |
download | postgresql-1dc34982511d91ef8a2b71bdcb870f067c1b3da9.tar.gz postgresql-1dc34982511d91ef8a2b71bdcb870f067c1b3da9.zip |
Standard pgindent run for 8.1.
Diffstat (limited to 'src/backend/port/dynloader')
-rw-r--r-- | src/backend/port/dynloader/aix.c | 48 | ||||
-rw-r--r-- | src/backend/port/dynloader/aix.h | 4 | ||||
-rw-r--r-- | src/backend/port/dynloader/bsdi.c | 11 | ||||
-rw-r--r-- | src/backend/port/dynloader/bsdi.h | 3 | ||||
-rw-r--r-- | src/backend/port/dynloader/hpux.c | 4 | ||||
-rw-r--r-- | src/backend/port/dynloader/linux.c | 11 | ||||
-rw-r--r-- | src/backend/port/dynloader/ultrix4.c | 10 | ||||
-rw-r--r-- | src/backend/port/dynloader/win32.c | 48 |
8 files changed, 68 insertions, 71 deletions
diff --git a/src/backend/port/dynloader/aix.c b/src/backend/port/dynloader/aix.c index a5d355c2cc2..3ace7fc3915 100644 --- a/src/backend/port/dynloader/aix.c +++ b/src/backend/port/dynloader/aix.c @@ -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; diff --git a/src/backend/port/dynloader/aix.h b/src/backend/port/dynloader/aix.h index 69e20ebae36..29d385986e1 100644 --- a/src/backend/port/dynloader/aix.h +++ b/src/backend/port/dynloader/aix.h @@ -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(); diff --git a/src/backend/port/dynloader/bsdi.c b/src/backend/port/dynloader/bsdi.c index 6b17a929f49..bc51569a30b 100644 --- a/src/backend/port/dynloader/bsdi.c +++ b/src/backend/port/dynloader/bsdi.c @@ -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) { diff --git a/src/backend/port/dynloader/bsdi.h b/src/backend/port/dynloader/bsdi.h index c7f2ab5e8cc..b73fa6141f8 100644 --- a/src/backend/port/dynloader/bsdi.h +++ b/src/backend/port/dynloader/bsdi.h @@ -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))) diff --git a/src/backend/port/dynloader/hpux.c b/src/backend/port/dynloader/hpux.c index b424e5b4c99..6a516387ba1 100644 --- a/src/backend/port/dynloader/hpux.c +++ b/src/backend/port/dynloader/hpux.c @@ -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; diff --git a/src/backend/port/dynloader/linux.c b/src/backend/port/dynloader/linux.c index 325e8f9920b..e62431140cc 100644 --- a/src/backend/port/dynloader/linux.c +++ b/src/backend/port/dynloader/linux.c @@ -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) { diff --git a/src/backend/port/dynloader/ultrix4.c b/src/backend/port/dynloader/ultrix4.c index c0e4555a382..c6315380839 100644 --- a/src/backend/port/dynloader/ultrix4.c +++ b/src/backend/port/dynloader/ultrix4.c @@ -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) diff --git a/src/backend/port/dynloader/win32.c b/src/backend/port/dynloader/win32.c index c2c496a5295..c2547f5a28d 100644 --- a/src/backend/port/dynloader/win32.c +++ b/src/backend/port/dynloader/win32.c @@ -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; |