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

Unified Diff: mojo/edk/util/scoped_file.h

Issue 1347783002: Add our own (mojo::util::)ScopedFILE and replace uses of base::ScopedFILE with it. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 3 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
« mojo/edk/system/BUILD.gn ('K') | « mojo/edk/util/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/util/scoped_file.h
diff --git a/mojo/edk/util/scoped_file.h b/mojo/edk/util/scoped_file.h
new file mode 100644
index 0000000000000000000000000000000000000000..7aeb868f975a8caea536f028d16dc5d5bb95e0b6
--- /dev/null
+++ b/mojo/edk/util/scoped_file.h
@@ -0,0 +1,32 @@
+// Copyright 2014 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.
+
+#ifndef MOJO_EDK_UTIL_SCOPED_FILE_H_
+#define MOJO_EDK_UTIL_SCOPED_FILE_H_
+
+#include <stdio.h>
+
+#include "base/memory/scoped_ptr.h"
+
+namespace mojo {
+namespace util {
+namespace internal {
+
+// Functor for |ScopedFILE| (below).
+struct ScopedFILECloser {
+ inline void operator()(FILE* x) const {
+ if (x)
+ fclose(x);
+ }
+};
+
+} // namespace internal
+
+// Automatically closes |FILE*|s.
+using ScopedFILE = scoped_ptr<FILE, internal::ScopedFILECloser>;
+
+} // namespace util
+} // namespace mojo
+
+#endif // MOJO_EDK_UTIL_SCOPED_FILE_H_
« mojo/edk/system/BUILD.gn ('K') | « mojo/edk/util/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698