remove unneeded PutEnv

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6224 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-02-21 14:48:18 +00:00
parent 80db139a76
commit fd70ae3b48
2 changed files with 0 additions and 53 deletions

View File

@ -368,53 +368,6 @@ string const GetEnvPath(string const & name)
}
bool PutEnv(string const & envstr)
{
// CHECK Look at and fix this.
// f.ex. what about error checking?
#if HAVE_PUTENV
// this leaks, but what can we do about it?
// Is doing a getenv() and a free() of the older value
// a good idea? (JMarc)
// Actually we don't have to leak...calling putenv like this
// should be enough: ... and this is obviously not enough if putenv
// does not make a copy of the string. It is also not very wise to
// put a string on the free store. If we have to leak we should do it
// like this:
char * leaker = new char[envstr.length() + 1];
envstr.copy(leaker, envstr.length());
leaker[envstr.length()] = '\0';
int const retval = lyx::putenv(leaker);
// If putenv does not make a copy of the char const * this
// is very dangerous. OTOH if it does take a copy this is the
// best solution.
// The only implementation of putenv that I have seen does not
// allocate memory. _And_ after testing the putenv in glibc it
// seems that we need to make a copy of the string contents.
// I will enable the above.
//int retval = lyx::putenv(envstr.c_str());
#else
#ifdef HAVE_SETENV
string varname;
string const str = envstr.split(varname,'=');
int const retval = ::setenv(varname.c_str(), str.c_str(), true);
#else
// No environment setting function. Can this happen?
int const retval = 1; //return an error condition.
#endif
#endif
return retval == 0;
}
bool PutEnvPath(string const & envstr)
{
return PutEnv(envstr);
}
namespace {
int DeleteAllFilesInDir(string const & path)

View File

@ -108,12 +108,6 @@ string const GetEnv(string const & envname);
/// A helper function.
string const GetEnvPath(string const & name);
///
bool PutEnv(string const & envstr);
///
bool PutEnvPath(string const & envstr);
/// Substitutes active latex characters with underscores in filename
string const MakeLatexName(string const & file);