summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayan Kamath2015-02-23 09:43:35 -0600
committerNarayan Kamath2015-02-23 09:49:43 -0600
commit6832a7a4e04c84192f0bafc6ac990fc79cd13882 (patch)
treee8c0940ae4a25e96db0ad84985991731f2b1b8f4 /libutils/Tokenizer.cpp
parentf1ac6917da172dd3e6829bac41fcbf23e96da079 (diff)
downloadplatform-system-core-6832a7a4e04c84192f0bafc6ac990fc79cd13882.tar.gz
platform-system-core-6832a7a4e04c84192f0bafc6ac990fc79cd13882.tar.xz
platform-system-core-6832a7a4e04c84192f0bafc6ac990fc79cd13882.zip
Remove useless refCounting from FileMap.
Nobody ever called acquire() so release() was always equivalent to delete. Just use delete instead so that people can use unique_ptr directly (or shared_ptr if they really want refcounts). Change-Id: I9e3ad5e0f6a4fcc4e02e5a2ff7ef9514fe234415
Diffstat (limited to 'libutils/Tokenizer.cpp')
-rw-r--r--libutils/Tokenizer.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/libutils/Tokenizer.cpp b/libutils/Tokenizer.cpp
index 7067533b1..610002fe3 100644
--- a/libutils/Tokenizer.cpp
+++ b/libutils/Tokenizer.cpp
@@ -43,9 +43,7 @@ Tokenizer::Tokenizer(const String8& filename, FileMap* fileMap, char* buffer,
43} 43}
44 44
45Tokenizer::~Tokenizer() { 45Tokenizer::~Tokenizer() {
46 if (mFileMap) { 46 delete mFileMap;
47 mFileMap->release();
48 }
49 if (mOwnBuffer) { 47 if (mOwnBuffer) {
50 delete[] mBuffer; 48 delete[] mBuffer;
51 } 49 }
@@ -74,7 +72,7 @@ status_t Tokenizer::open(const String8& filename, Tokenizer** outTokenizer) {
74 fileMap->advise(FileMap::SEQUENTIAL); 72 fileMap->advise(FileMap::SEQUENTIAL);
75 buffer = static_cast<char*>(fileMap->getDataPtr()); 73 buffer = static_cast<char*>(fileMap->getDataPtr());
76 } else { 74 } else {
77 fileMap->release(); 75 delete fileMap;
78 fileMap = NULL; 76 fileMap = NULL;
79 77
80 // Fall back to reading into a buffer since we can't mmap files in sysfs. 78 // Fall back to reading into a buffer since we can't mmap files in sysfs.