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

Unified Diff: third_party/android_crazy_linker/src/src/crazy_linker_error.h

Issue 1180693002: Update from https://crrev.com/333737 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 years, 6 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
Index: third_party/android_crazy_linker/src/src/crazy_linker_error.h
diff --git a/third_party/android_crazy_linker/src/src/crazy_linker_error.h b/third_party/android_crazy_linker/src/src/crazy_linker_error.h
new file mode 100644
index 0000000000000000000000000000000000000000..effda79ad66c38f789ee8b778230514edc073d03
--- /dev/null
+++ b/third_party/android_crazy_linker/src/src/crazy_linker_error.h
@@ -0,0 +1,45 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CRAZY_LINKER_ERROR_H
+#define CRAZY_LINKER_ERROR_H
+
+namespace crazy {
+
+// A class used to hold a fixed-size buffer to hold error messages
+// as well as perform assignment and formatting.
+//
+// Usage examples:
+// Error error;
+// error = "Unimplemented feature";
+// error->Set("Unimplemented feature");
+// error->Format("Feature %s is not implemented", feature_name);
+// error->Append(strerror(errno));
+// error->AppendFormat("Error: %s", strerror(errno));
+//
+class Error {
+ public:
+ Error() { buff_[0] = '\0'; }
+
+ Error(const char* message) { Set(message); }
+
+ Error(const Error& other) { Set(other.buff_); }
+
+ const char* c_str() const { return buff_; }
+
+ void Set(const char* message);
+
+ void Format(const char* fmt, ...);
+
+ void Append(const char* message);
+
+ void AppendFormat(const char* fmt, ...);
+
+ private:
+ char buff_[512];
+};
+
+} // namespace crazy
+
+#endif // CRAZY_LINKER_ERROR_H

Powered by Google App Engine
This is Rietveld 408576698