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

Unified Diff: runtime/bin/directory_fuchsia.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_android.cc ('k') | runtime/bin/directory_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/directory_fuchsia.cc
diff --git a/runtime/bin/directory_fuchsia.cc b/runtime/bin/directory_fuchsia.cc
index c2139104c7e6aefb1438ebe4381ce8de43b4539f..6b7fc5bd50128d802068bcf3d4500741bee6b334 100644
--- a/runtime/bin/directory_fuchsia.cc
+++ b/runtime/bin/directory_fuchsia.cc
@@ -7,13 +7,13 @@
#include "bin/directory.h"
-#include <dirent.h> // NOLINT
-#include <errno.h> // NOLINT
-#include <stdlib.h> // NOLINT
-#include <string.h> // NOLINT
+#include <dirent.h> // NOLINT
+#include <errno.h> // NOLINT
+#include <stdlib.h> // NOLINT
+#include <string.h> // NOLINT
#include <sys/param.h> // NOLINT
-#include <sys/stat.h> // NOLINT
-#include <unistd.h> // NOLINT
+#include <sys/stat.h> // NOLINT
+#include <unistd.h> // NOLINT
#include "bin/dartutils.h"
#include "bin/file.h"
@@ -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) {
const intptr_t name_length = strnlen(name, PATH_MAX + 1);
if (name_length == 0) {
@@ -74,13 +68,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 {
@@ -89,7 +81,6 @@ struct LinkList {
LinkList* next;
};
-
ListType DirectoryListingEntry::Next(DirectoryListing* listing) {
if (done_) {
return kListDone;
@@ -189,7 +180,6 @@ ListType DirectoryListingEntry::Next(DirectoryListing* listing) {
return kListDone;
}
-
DirectoryListingEntry::~DirectoryListingEntry() {
ResetLink();
if (lister_ != 0) {
@@ -197,7 +187,6 @@ DirectoryListingEntry::~DirectoryListingEntry() {
}
}
-
void DirectoryListingEntry::ResetLink() {
if ((link_ != NULL) && ((parent_ == NULL) || (parent_->link_ != link_))) {
delete link_;
@@ -208,7 +197,6 @@ void DirectoryListingEntry::ResetLink() {
}
}
-
Directory::ExistsResult Directory::Exists(const char* dir_name) {
struct stat entry_info;
int success = NO_RETRY_EXPECTED(stat(dir_name, &entry_info));
@@ -235,12 +223,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) {
@@ -249,12 +235,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.
@@ -266,7 +250,6 @@ bool Directory::Create(const char* dir_name) {
return (result == 0);
}
-
const char* Directory::SystemTemp() {
PathBuffer path;
const char* temp_dir = getenv("TMPDIR");
@@ -289,7 +272,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
@@ -310,16 +292,13 @@ const char* Directory::CreateTemp(const char* prefix) {
return path.AsScopedString();
}
-
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;
@@ -327,7 +306,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.
@@ -402,7 +380,6 @@ static bool DeleteRecursively(PathBuffer* path) {
return false;
}
-
bool Directory::Delete(const char* dir_name, bool recursive) {
if (!recursive) {
if ((File::GetType(dir_name, false) == File::kIsLink) &&
@@ -419,7 +396,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_android.cc ('k') | runtime/bin/directory_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698