diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-31 02:26:40 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-31 02:26:40 +0000 |
commit | a324a45fada4feccc9175b1ca37e3cf8be99148c (patch) | |
tree | 046c897cdd5187496b019a6d4427f8201354087e /chrome/plugin | |
parent | c9c6f5cbd15124457b0fe77f03fda9e4c4855f48 (diff) | |
download | chromium_src-a324a45fada4feccc9175b1ca37e3cf8be99148c.zip chromium_src-a324a45fada4feccc9175b1ca37e3cf8be99148c.tar.gz chromium_src-a324a45fada4feccc9175b1ca37e3cf8be99148c.tar.bz2 |
Revert 54418 - base: Add UnSetEnv function to EnvVarGetter API.
BUG=None
TEST=out/Debug/base_unittests --gtest_filter=EnvVarTest.UnSetEnvVar
Signed-off-by: Thiago Farina <tfarina@chromium.org>
Review URL: http://codereview.chromium.org/3043018
TBR=tfarina@chromium.org
Review URL: http://codereview.chromium.org/2847092
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54422 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/plugin')
-rw-r--r-- | chrome/plugin/plugin_main_mac.mm | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/chrome/plugin/plugin_main_mac.mm b/chrome/plugin/plugin_main_mac.mm index 119f986..56b7c95 100644 --- a/chrome/plugin/plugin_main_mac.mm +++ b/chrome/plugin/plugin_main_mac.mm @@ -1,21 +1,17 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/chrome_application_mac.h" -#include "base/env_var.h" -#include "base/scoped_ptr.h" #include "base/string_util.h" #include "chrome/common/plugin_carbon_interpose_constants_mac.h" #include "chrome/plugin/plugin_interpose_util_mac.h" #if !defined(__LP64__) void TrimInterposeEnvironment() { - scoped_ptr<base::EnvVarGetter> env(base::EnvVarGetter::Create()); - - std::string interpose_list; - if (!env->GetEnv(plugin_interpose_strings::kDYLDInsertLibrariesKey, - &interpose_list)) { + const char* interpose_list = + getenv(plugin_interpose_strings::kDYLDInsertLibrariesKey); + if (!interpose_list) { NOTREACHED() << "No interposing libraries set"; return; } @@ -25,19 +21,19 @@ void TrimInterposeEnvironment() { // need to handle are: // 1) The whole string is "<kInterposeLibraryPath>", so just clear it, or // 2) ":<kInterposeLibraryPath>" is the end of the string, so trim and re-set. - int suffix_offset = strlen(interpose_list.c_str()) - + int suffix_offset = strlen(interpose_list) - strlen(plugin_interpose_strings::kInterposeLibraryPath); - if (suffix_offset == 0 && - strcmp(interpose_list.c_str(), + strcmp(interpose_list, plugin_interpose_strings::kInterposeLibraryPath) == 0) { - env->UnSetEnv(plugin_interpose_strings::kDYLDInsertLibrariesKey); + unsetenv(plugin_interpose_strings::kDYLDInsertLibrariesKey); } else if (suffix_offset > 0 && interpose_list[suffix_offset - 1] == ':' && - strcmp(interpose_list.c_str() + suffix_offset, + strcmp(interpose_list + suffix_offset, plugin_interpose_strings::kInterposeLibraryPath) == 0) { - std::string trimmed_list = interpose_list.substr(0, suffix_offset - 1); - env->SetEnv(plugin_interpose_strings::kDYLDInsertLibrariesKey, - trimmed_list.c_str()); + std::string trimmed_list = + std::string(interpose_list).substr(0, suffix_offset - 1); + setenv(plugin_interpose_strings::kDYLDInsertLibrariesKey, + trimmed_list.c_str(), 1); } else { NOTREACHED() << "Missing Carbon interposing library"; } |