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

Unified Diff: runtime/bin/directory_linux.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_fuchsia.cc ('k') | runtime/bin/directory_macos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/directory_linux.cc
diff --git a/runtime/bin/directory_linux.cc b/runtime/bin/directory_linux.cc
index b3acd6ff11992f8925d7b665e1ac9429ba7e3bc3..6e50322f564bbeb0b125c8f7aab84a80cb7c36c1 100644
--- a/runtime/bin/directory_linux.cc
+++ b/runtime/bin/directory_linux.cc
@@ -27,34 +27,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);
@@ -69,13 +63,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 {
@@ -84,7 +76,6 @@ struct LinkList {
LinkList* next;
};
-
ListType DirectoryListingEntry::Next(DirectoryListing* listing) {
if (done_) {
return kListDone;
@@ -214,7 +205,6 @@ ListType DirectoryListingEntry::Next(DirectoryListing* listing) {
return kListDone;
}
-
DirectoryListingEntry::~DirectoryListingEntry() {
ResetLink();
if (lister_ != 0) {
@@ -222,7 +212,6 @@ DirectoryListingEntry::~DirectoryListingEntry() {
}
}
-
void DirectoryListingEntry::ResetLink() {
if ((link_ != NULL) && ((parent_ == NULL) || (parent_->link_ != link_))) {
delete link_;
@@ -233,16 +222,13 @@ void DirectoryListingEntry::ResetLink() {
}
}
-
static bool DeleteRecursively(PathBuffer* path);
-
static bool DeleteFile(char* file_name, PathBuffer* path) {
return path->Add(file_name) &&
(NO_RETRY_EXPECTED(unlink(path->AsString())) == 0);
}
-
static bool DeleteDir(char* dir_name, PathBuffer* path) {
if ((strcmp(dir_name, ".") == 0) || (strcmp(dir_name, "..") == 0)) {
return true;
@@ -250,7 +236,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.
@@ -352,7 +337,6 @@ static bool DeleteRecursively(PathBuffer* path) {
return false;
}
-
Directory::ExistsResult Directory::Exists(const char* dir_name) {
struct stat64 entry_info;
int success = TEMP_FAILURE_RETRY(stat64(dir_name, &entry_info));
@@ -379,12 +363,10 @@ Directory::ExistsResult Directory::Exists(const char* dir_name) {
}
}
-
char* Directory::CurrentNoScope() {
return getcwd(NULL, 0);
}
-
const char* Directory::Current() {
char buffer[PATH_MAX];
if (getcwd(buffer, PATH_MAX) == NULL) {
@@ -393,12 +375,10 @@ const char* Directory::Current() {
return DartUtils::ScopedCopyCString(buffer);
}
-
bool Directory::SetCurrent(const char* path) {
return (NO_RETRY_EXPECTED(chdir(path)) == 0);
}
-
bool Directory::Create(const char* dir_name) {
// Create the directory with the permissions specified by the
// process umask.
@@ -410,7 +390,6 @@ bool Directory::Create(const char* dir_name) {
return (result == 0);
}
-
const char* Directory::SystemTemp() {
PathBuffer path;
const char* temp_dir = getenv("TMPDIR");
@@ -433,7 +412,6 @@ const char* Directory::SystemTemp() {
return path.AsScopedString();
}
-
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
@@ -457,7 +435,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) &&
@@ -474,7 +451,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_fuchsia.cc ('k') | runtime/bin/directory_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698