diff options
Diffstat (limited to 'src/port/win32env.c')
-rw-r--r-- | src/port/win32env.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/src/port/win32env.c b/src/port/win32env.c index 36888286b7..9a32387337 100644 --- a/src/port/win32env.c +++ b/src/port/win32env.c @@ -1,16 +1,16 @@ /*------------------------------------------------------------------------- * * win32env.c - * putenv() and unsetenv() for win32, that updates both process - * environment and the cached versions in (potentially multiple) - * MSVCRT. + * putenv() and unsetenv() for win32, that updates both process + * environment and the cached versions in (potentially multiple) + * MSVCRT. * * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/win32env.c,v 1.2 2009/02/12 12:53:34 mha Exp $ + * $PostgreSQL: pgsql/src/port/win32env.c,v 1.3 2009/06/11 14:49:15 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -20,41 +20,41 @@ int pgwin32_putenv(const char *envval) { - char *envcpy; - char *cp; + char *envcpy; + char *cp; /* * Each version of MSVCRT has its own _putenv() call in the runtime * library. * - * If we're in VC 7.0 or later (means != mingw), update in - * the 6.0 MSVCRT.DLL environment as well, to work with third party - * libraries linked against it (such as gnuwin32 libraries). + * If we're in VC 7.0 or later (means != mingw), update in the 6.0 + * MSVCRT.DLL environment as well, to work with third party libraries + * linked against it (such as gnuwin32 libraries). */ #if defined(_MSC_VER) && (_MSC_VER >= 1300) - typedef int (_cdecl *PUTENVPROC)(const char *); - HMODULE hmodule; - static PUTENVPROC putenvFunc = NULL; - int ret; + typedef int (_cdecl * PUTENVPROC) (const char *); + HMODULE hmodule; + static PUTENVPROC putenvFunc = NULL; + int ret; if (putenvFunc == NULL) { hmodule = GetModuleHandle("msvcrt"); if (hmodule == NULL) return 1; - putenvFunc = (PUTENVPROC)GetProcAddress(hmodule, "_putenv"); + putenvFunc = (PUTENVPROC) GetProcAddress(hmodule, "_putenv"); if (putenvFunc == NULL) return 1; } ret = putenvFunc(envval); if (ret != 0) return ret; -#endif /* _MSC_VER >= 1300 */ +#endif /* _MSC_VER >= 1300 */ /* - * Update the process environment - to make modifications visible - * to child processes. + * Update the process environment - to make modifications visible to child + * processes. * * Need a copy of the string so we can modify it. */ @@ -68,8 +68,8 @@ pgwin32_putenv(const char *envval) { /* * Only call SetEnvironmentVariable() when we are adding a variable, - * not when removing it. Calling it on both crashes on at least certain - * versions of MingW. + * not when removing it. Calling it on both crashes on at least + * certain versions of MingW. */ if (!SetEnvironmentVariable(envcpy, cp)) { @@ -86,9 +86,9 @@ pgwin32_putenv(const char *envval) void pgwin32_unsetenv(const char *name) { - char *envbuf; + char *envbuf; - envbuf = (char *) malloc(strlen(name)+2); + envbuf = (char *) malloc(strlen(name) + 2); if (!envbuf) return; @@ -96,4 +96,3 @@ pgwin32_unsetenv(const char *name) pgwin32_putenv(envbuf); free(envbuf); } - |