diff options
author | Sravan Kumar Lakkimsetti | 2020-12-23 08:03:14 +0000 |
---|---|---|
committer | Sravan Kumar Lakkimsetti | 2020-12-23 08:03:14 +0000 |
commit | 3de698e0445d53ab78e17cc6f0a6413fa5f944e5 (patch) | |
tree | 3018856a5551800233047b457605d12503e9c399 | |
parent | 568bf3e23bbcfe2a63988143a7cc734a3b73cf7b (diff) | |
download | rt.equinox.framework-3de698e0445d53ab78e17cc6f0a6413fa5f944e5.tar.gz rt.equinox.framework-3de698e0445d53ab78e17cc6f0a6413fa5f944e5.tar.xz rt.equinox.framework-3de698e0445d53ab78e17cc6f0a6413fa5f944e5.zip |
Revert "Bug 102239 - Environment variable substitution in <launcher>.ini/eclipse.ini"
This reverts commit f49d80cfb5265ec98888ac9f48b219ac16863cc4.
-rw-r--r-- | features/org.eclipse.equinox.executable.feature/library/eclipseConfig.c | 55 |
1 files changed, 1 insertions, 54 deletions
diff --git a/features/org.eclipse.equinox.executable.feature/library/eclipseConfig.c b/features/org.eclipse.equinox.executable.feature/library/eclipseConfig.c index 7111cdd02..172f20236 100644 --- a/features/org.eclipse.equinox.executable.feature/library/eclipseConfig.c +++ b/features/org.eclipse.equinox.executable.feature/library/eclipseConfig.c @@ -38,59 +38,6 @@ #endif -static const _TCHAR LHS[] = _T_ECLIPSE("$"); /* left-hand side marker */ -static const _TCHAR RHS[] = _T_ECLIPSE("$"); /* right-hand side marker */ -static const unsigned short LHS_LEN = (sizeof(LHS) - sizeof(_TCHAR)) / sizeof(_TCHAR); -static const unsigned short RHS_LEN = (sizeof(RHS) - sizeof(_TCHAR)) / sizeof(_TCHAR); - -/* we use a function pointer to abstract out the logic from getenv() - to ease testing */ -_TCHAR * expandEnvVarsInternal(const _TCHAR * input, _TCHAR* (*resolve)(const _TCHAR *)) { - _TCHAR * result; - const _TCHAR * lhsOuterPos = _tcsstr(input, LHS); - - if ((lhsOuterPos != NULL) && _tcslen(lhsOuterPos) > LHS_LEN) { - const _TCHAR * lhsInnerPos = lhsOuterPos + LHS_LEN - 1; - const _TCHAR * rhsInnerPos = _tcsstr(lhsInnerPos, RHS); - - if (rhsInnerPos != NULL) { - const _TCHAR * value; - _TCHAR * var = (_TCHAR *) calloc((rhsInnerPos - lhsInnerPos), sizeof(_TCHAR)); - - _tcsncpy(var, lhsInnerPos + 1, (rhsInnerPos - lhsInnerPos - 1)); - value = resolve(var); - - free(var); - - if (value != NULL) { - /* expand remaining of the original string */ - _TCHAR * remaining = expandEnvVarsInternal(rhsInnerPos + RHS_LEN, resolve); - - /* length of the beginning of the original string */ - const unsigned int beginLen = lhsOuterPos - input; - size_t len = beginLen - + _tcslen(value) /* de-referenced variable */ - + _tcslen(remaining) /* rest of the string (expanded vars) */ - + 1; /* string terminator */ - - result = (_TCHAR *) calloc(len, sizeof(_TCHAR)); - _tcsncpy(result, input, beginLen); - _tcscat(result, value); - _tcscat(result, remaining); - - free(remaining); - - return result; - } - } - } - - /* nothing to expand, just return a copy of the original string */ - result = _tcsdup(input); - - return result; -} - int readIniFile(_TCHAR* program, int *argc, _TCHAR ***argv) { _TCHAR* config_file = NULL; @@ -206,7 +153,7 @@ int readConfigFile( _TCHAR * config_file, int *argc, _TCHAR ***argv ) if(argument[0] == _T_ECLIPSE('#')) continue; - arg = expandEnvVarsInternal(argument, _tgetenv); + arg = _tcsdup(argument); length = _tcslen(arg); /* basic whitespace trimming */ |