Remove file name from File C++ structure. It is not used.

Currently, the field is being assigned a string that we
immediately deallocate leaving the field invalid. Since
it is not used we should get rid of it.

R=aprelev@gmail.com,sgjesse@google.com
BUG=

Review URL: https://codereview.chromium.org//11348006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14188 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
ager@google.com
2012-10-29 12:02:35 +00:00
parent 83f2cfa4c1
commit d166fef422
6 changed files with 8 additions and 12 deletions
+1 -4
View File
@@ -109,8 +109,6 @@ class File {
// Returns whether the file has been closed.
bool IsClosed();
const char* name() const { return name_; }
// Open the file with the given name. The file is always opened for
// reading. If mode contains kWrite the file is opened for both
// reading and writing. If mode contains kWrite and the file does
@@ -139,12 +137,11 @@ class File {
static Dart_Port GetServicePort();
private:
File(const char* name, FileHandle* handle) : name_(name), handle_(handle) { }
explicit File(FileHandle* handle) : handle_(handle) { }
void Close();
static const int kClosedFd = -1;
const char* name_;
// FileHandle is an OS specific class which stores data about the file.
FileHandle* handle_; // OS specific handle for the file.
+2 -2
View File
@@ -125,13 +125,13 @@ File* File::Open(const char* name, FileOpenMode mode) {
return NULL;
}
}
return new File(name, new FileHandle(fd));
return new File(new FileHandle(fd));
}
File* File::OpenStdio(int fd) {
if (fd < 0 || 2 < fd) return NULL;
return new File(NULL, new FileHandle(fd));
return new File(new FileHandle(fd));
}
+2 -2
View File
@@ -125,13 +125,13 @@ File* File::Open(const char* name, FileOpenMode mode) {
return NULL;
}
}
return new File(name, new FileHandle(fd));
return new File(new FileHandle(fd));
}
File* File::OpenStdio(int fd) {
if (fd < 0 || 2 < fd) return NULL;
return new File(NULL, new FileHandle(fd));
return new File(new FileHandle(fd));
}
+2 -2
View File
@@ -126,13 +126,13 @@ File* File::Open(const char* name, FileOpenMode mode) {
return NULL;
}
}
return new File(name, new FileHandle(fd));
return new File(new FileHandle(fd));
}
File* File::OpenStdio(int fd) {
if (fd < 0 || 2 < fd) return NULL;
return new File(NULL, new FileHandle(fd));
return new File(new FileHandle(fd));
}
-1
View File
@@ -24,7 +24,6 @@ UNIT_TEST_CASE(Read) {
const char* kFilename = GetFileName("runtime/bin/file_test.cc");
File* file = File::Open(kFilename, File::kRead);
EXPECT(file != NULL);
EXPECT_STREQ(kFilename, file->name());
char buffer[16];
buffer[0] = '\0';
EXPECT(file->ReadFully(buffer, 13)); // ReadFully returns true.
+1 -1
View File
@@ -114,7 +114,7 @@ File* File::Open(const char* name, FileOpenMode mode) {
return NULL;
}
}
return new File(name, new FileHandle(fd));
return new File(new FileHandle(fd));
}