summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-01-25 18:28:34 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-01-25 18:28:34 +0000
commit25024467b97d2bf3f7a06358bde107ada4d4db41 (patch)
tree9d4a55e6ed764b81b437d64ee71ee0e87623a995 /libs
parent065f841eabb4414821e099dd7262bc021e1f9857 (diff)
fix use of environ in shared library on OS X
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@8571 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/pbd/epa.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/libs/pbd/epa.cc b/libs/pbd/epa.cc
index 3d3f7477d7..a12dc961a9 100644
--- a/libs/pbd/epa.cc
+++ b/libs/pbd/epa.cc
@@ -23,7 +23,12 @@
#include "pbd/epa.h"
#include "pbd/strsplit.h"
+#ifdef __APPLE__
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+#else
extern char** environ;
+#endif
using namespace PBD;
using namespace std;
@@ -55,14 +60,26 @@ EnvironmentalProtectionAgency::arm ()
void
EnvironmentalProtectionAgency::save ()
{
+ /* do this to avoid lots of calls to _NSGetEnviron() on OS X */
+ char** the_environ = environ;
+
e.clear ();
+<<<<<<< .mine
+ for (size_t i = 0; the_environ[i]; ++i) {
+=======
if (!_envname.empty()) {
/* fetch environment from named environment variable, rather than "environ"
*/
+>>>>>>> .r8570
+<<<<<<< .mine
+ string estring = the_environ[i];
+ string::size_type equal = estring.find_first_of ('=');
+=======
const char* estr = getenv (_envname.c_str());
+>>>>>>> .r8570
if (!estr) {
return;