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

Unified Diff: third_party/hwcplus/src/hwcplus_util.c

Issue 321353002: Add __android_log_assert. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: really fix formatting Created 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/hwcplus/src/hwcplus_util.c
diff --git a/third_party/hwcplus/src/hwcplus_util.c b/third_party/hwcplus/src/hwcplus_util.c
index 57c4519c8790370db400a6e5cee03295b60d156c..1c7873af8e52e667a5ee2bc0d7dca57f87d75634 100644
--- a/third_party/hwcplus/src/hwcplus_util.c
+++ b/third_party/hwcplus/src/hwcplus_util.c
@@ -6,8 +6,9 @@
#include <stdio.h>
#include <string.h>
-#include <hardware/hardware.h>
+#include <android/log.h>
#include <cutils/properties.h>
+#include <hardware/hardware.h>
#define LOG_BUF_SIZE 1024
@@ -64,6 +65,33 @@ int __android_log_print(int prio, const char* tag, const char* fmt, ...) {
return __android_log_write(prio, tag, buf);
}
+void __android_log_assert(const char* cond,
+ const char* tag,
+ const char* fmt,
+ ...) {
+ char buf[LOG_BUF_SIZE];
+
+ if (fmt) {
+ va_list ap;
+ va_start(ap, fmt);
+ vsnprintf(buf, LOG_BUF_SIZE, fmt, ap);
+ va_end(ap);
+ } else {
+ /* Msg not provided, log condition. N.B. Do not use cond directly as
+ * format string as it could contain spurious '%' syntax (e.g.
+ * "%d" in "blocks%devs == 0").
+ */
+ if (cond)
+ snprintf(buf, LOG_BUF_SIZE, "Assertion failed: %s", cond);
+ else
+ snprintf(buf, LOG_BUF_SIZE, "Unspecified assertion failed");
+ }
+
+ __android_log_write(ANDROID_LOG_FATAL, tag, buf);
+
+ __builtin_trap(); /* trap so we have a chance to debug the situation */
+}
+
int property_get(const char* key, char* value, const char* default_value) {
printf("property_get %s\n", key);
const char* r = default_value;
@@ -72,4 +100,3 @@ int property_get(const char* key, char* value, const char* default_value) {
strncpy(value, r, PROPERTY_VALUE_MAX);
return strlen(r);
}
-
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698