mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
simplify C-sytle code
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21935 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
be0895b664
commit
dbda8edf6d
@ -18,7 +18,6 @@
|
||||
#include "support/os.h"
|
||||
|
||||
#include <boost/tokenizer.hpp>
|
||||
#include <boost/shared_array.hpp>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <map>
|
||||
@ -67,16 +66,9 @@ bool setEnv(string const & name, string const & value)
|
||||
#if defined (HAVE_SETENV)
|
||||
return ::setenv(name.c_str(), encoded.c_str(), true);
|
||||
#elif defined (HAVE_PUTENV)
|
||||
static std::map<string, boost::shared_array<char> > varmap;
|
||||
|
||||
string envstr = name + '=' + encoded;
|
||||
boost::shared_array<char> newptr(new char[envstr.size() + 1]);
|
||||
envstr.copy(newptr.get(), envstr.length());
|
||||
newptr.get()[envstr.length()] = '\0';
|
||||
bool const retval = ::putenv(newptr.get()) == 0;
|
||||
|
||||
varmap[name] = newptr;
|
||||
return retval;
|
||||
static std::map<string, string> varmap;
|
||||
varmap[name] = name + '=' + encoded;
|
||||
return ::putenv(varmap[name].c_str()) == 0;
|
||||
#else
|
||||
#error No environment-setting function has been defined.
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user