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

Unified Diff: runtime/bin/directory_android.cc

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 years, 5 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 | « runtime/bin/directory.cc ('k') | runtime/bin/directory_fuchsia.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/directory_android.cc
diff --git a/runtime/bin/directory_android.cc b/runtime/bin/directory_android.cc
index 43ad142bbd5d2edd19357390ca3293f38ddb5c00..61addabc3676d7833ee8c81c9695ed90fbc9bbc3 100644
--- a/runtime/bin/directory_android.cc
+++ b/runtime/bin/directory_android.cc
@@ -26,34 +26,28 @@ PathBuffer::PathBuffer() : length_(0) {
data_ = calloc(PATH_MAX + 1, sizeof(char)); // NOLINT
}
-
PathBuffer::~PathBuffer() {
free(data_);
}
-
bool PathBuffer::AddW(const wchar_t* name) {
UNREACHABLE();
return false;
}
-
char* PathBuffer::AsString() const {
return reinterpret_cast<char*>(data_);
}
-
wchar_t* PathBuffer::AsStringW() const {
UNREACHABLE();
return NULL;
}
-
const char* PathBuffer::AsScopedString() const {
return DartUtils::ScopedCopyCString(AsString());
}
-
bool PathBuffer::Add(const char* name) {
char* data = AsString();
int written = snprintf(data + length_, PATH_MAX - length_, "%s", name);
@@ -68,13 +62,11 @@ bool PathBuffer::Add(const char* name) {
}
}
-
void PathBuffer::Reset(intptr_t new_length) {
length_ = new_length;
AsString()[length_] = '\0';
}
-
// A linked list of symbolic links, with their unique file system identifiers.
// These are scanned to detect loops while doing a recursive directory listing.
struct LinkList {
@@ -83,7 +75,6 @@ struct LinkList {
LinkList* next;
};
-
ListType DirectoryListingEntry::Next(DirectoryListing* listing) {
if (done_) {
return kListDone;
@@ -217,7 +208,6 @@ ListType DirectoryListingEntry::Next(DirectoryListing* listing) {
return kListDone;
}
-
DirectoryListingEntry::~DirectoryListingEntry() {
ResetLink();
if (lister_ != 0) {
@@ -225,7 +215,6 @@ DirectoryListingEntry::~DirectoryListingEntry() {
}
}
-
void DirectoryListingEntry::ResetLink() {
if ((link_ != NULL) && ((parent_ == NULL) || (parent_->link_ != link_))) {
delete link_;
@@ -236,15 +225,12 @@ void DirectoryListingEntry::ResetLink() {
}
}
-
static bool DeleteRecursively(PathBuffer* path);
-
static bool DeleteFile(char* file_name, PathBuffer* path) {
return path->Add(file_name) && (unlink(path->AsString()) == 0);
}
-
static bool DeleteDir(char* dir_name, PathBuffer* path) {
if ((strcmp(dir_name, ".") == 0) || (strcmp(dir_name, "..") == 0)) {
return true;
@@ -252,7 +238,6 @@ static bool DeleteDir(char* dir_name, PathBuffer* path) {
return path->Add(dir_name) && DeleteRecursively(path);
}
-
static bool DeleteRecursively(PathBuffer* path) {
// Do not recurse into links for deletion. Instead delete the link.
// If it's a file, delete it.
@@ -343,7 +328,6 @@ static bool DeleteRecursively(PathBuffer* path) {
return false;
}
-
Directory::ExistsResult Directory::Exists(const char* dir_name) {
struct stat entry_info;
int success = NO_RETRY_EXPECTED(stat(dir_name, &entry_info));
@@ -370,7 +354,6 @@ Directory::ExistsResult Directory::Exists(const char* dir_name) {
}
}
-
char* Directory::CurrentNoScope() {
// Android's getcwd adheres closely to the POSIX standard. It won't
// allocate memory. We need to make our own copy.
@@ -382,7 +365,6 @@ char* Directory::CurrentNoScope() {
return strdup(buffer);
}
-
const char* Directory::Current() {
char buffer[PATH_MAX];
if (getcwd(buffer, PATH_MAX) == NULL) {
@@ -391,13 +373,11 @@ const char* Directory::Current() {
return DartUtils::ScopedCopyCString(buffer);
}
-
bool Directory::SetCurrent(const char* path) {
int result = NO_RETRY_EXPECTED(chdir(path));
return (result == 0);
}
-
bool Directory::Create(const char* dir_name) {
// Create the directory with the permissions specified by the
// process umask.
@@ -409,7 +389,6 @@ bool Directory::Create(const char* dir_name) {
return (result == 0);
}
-
const char* Directory::SystemTemp() {
if (Directory::system_temp_path_override_ != NULL) {
return DartUtils::ScopedCopyCString(Directory::system_temp_path_override_);
@@ -429,7 +408,6 @@ const char* Directory::SystemTemp() {
return ANDROID_TEMP_DIR;
}
-
const char* Directory::CreateTemp(const char* prefix) {
// Returns a new, unused directory name, adding characters to the end
// of prefix. Creates the directory with the permissions specified
@@ -453,7 +431,6 @@ const char* Directory::CreateTemp(const char* prefix) {
return path.AsScopedString();
}
-
bool Directory::Delete(const char* dir_name, bool recursive) {
if (!recursive) {
if ((File::GetType(dir_name, false) == File::kIsLink) &&
@@ -470,7 +447,6 @@ bool Directory::Delete(const char* dir_name, bool recursive) {
}
}
-
bool Directory::Rename(const char* path, const char* new_path) {
ExistsResult exists = Exists(path);
if (exists != EXISTS) {
« no previous file with comments | « runtime/bin/directory.cc ('k') | runtime/bin/directory_fuchsia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698