Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(669)

Unified Diff: base/process_util_mac.mm

Issue 14749003: Stop overwriting errno in base::StringPrintf, StringAppendV, and StringToDouble (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comment Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/base.gyp ('k') | base/scoped_clear_errno.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_util_mac.mm
diff --git a/base/process_util_mac.mm b/base/process_util_mac.mm
index b4ccd4a44ea281265f30bc65ee6f3c670de656df..e0174b4bc8894d71efbd6f5c8d406c9262d51ab9 100644
--- a/base/process_util_mac.mm
+++ b/base/process_util_mac.mm
@@ -32,6 +32,7 @@
#include "base/mac/mac_util.h"
#include "base/mac/scoped_mach_port.h"
#include "base/posix/eintr_wrapper.h"
+#include "base/scoped_clear_errno.h"
#include "base/string_util.h"
#include "base/sys_info.h"
#include "third_party/apple_apsl/CFBase.h"
@@ -546,25 +547,6 @@ malloc_error_break_t LookUpMallocErrorBreak() {
return reinterpret_cast<malloc_error_break_t>(reference_addr);
}
-// Simple scoper that saves the current value of errno, resets it to 0, and on
-// destruction puts the old value back. This is so that CrMallocErrorBreak can
-// safely test errno free from the effects of other routines.
-class ScopedClearErrno {
- public:
- ScopedClearErrno() : old_errno_(errno) {
- errno = 0;
- }
- ~ScopedClearErrno() {
- if (errno == 0)
- errno = old_errno_;
- }
-
- private:
- int old_errno_;
-
- DISALLOW_COPY_AND_ASSIGN(ScopedClearErrno);
-};
-
// Combines ThreadLocalBoolean with AutoReset. It would be convenient
// to compose ThreadLocalPointer<bool> with base::AutoReset<bool>, but that
// would require allocating some storage for the bool.
« no previous file with comments | « base/base.gyp ('k') | base/scoped_clear_errno.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698