Permalink
Browse files

- fix the real Windows related bug and undo the last commit

  • Loading branch information...
1 parent 020c324 commit 0f41dcae8d6301a2d769fb08d518ac5368df8f6c @jconway committed Oct 10, 2010
Showing with 7 additions and 5 deletions.
  1. +6 −4 pg_userfuncs.c
  2. +1 −1 plr.c
View
@@ -34,7 +34,7 @@
extern MemoryContext plr_SPI_context;
-#if !defined(WIN32) && !defined(WIN64)
+#ifndef WIN32
extern char **environ;
#endif
@@ -284,7 +284,7 @@ plr_environ(PG_FUNCTION_ARGS)
char *var_name;
char *var_val;
char *values[2];
-#if !defined(WIN32) && !defined(WIN64)
+#ifndef WIN32
char **current_env;
#else
char *buf;
@@ -326,7 +326,7 @@ plr_environ(PG_FUNCTION_ARGS)
/* initialize our tuplestore */
tupstore = TUPLESTORE_BEGIN_HEAP;
-#if !defined(WIN32) && !defined(WIN64)
+#ifndef WIN32
for (current_env = environ;
current_env != NULL && *current_env != NULL;
current_env++)
@@ -361,6 +361,8 @@ plr_environ(PG_FUNCTION_ARGS)
envstr++;
count++;
}
+ /* reset pointer to the environment buffer */
+ envstr = buf;
while(*buf == '=')
buf++;
@@ -388,7 +390,7 @@ plr_environ(PG_FUNCTION_ARGS)
buf++;
}
- FreeEnvironmentStrings(buf);
+ FreeEnvironmentStrings(envstr);
#endif
/*
View
2 plr.c
@@ -380,7 +380,7 @@ plr_init(void)
/* arrange for automatic cleanup at proc_exit */
on_proc_exit(plr_cleanup, 0);
-#if !defined(WIN32) && !defined(WIN64)
+#ifndef WIN32
/*
* Force non-interactive mode since R may not do so.
* See comment in Rembedded.c just after R_Interactive = TRUE:

0 comments on commit 0f41dca

Please sign in to comment.