summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn2017-03-09 10:09:43 -0600
committerMark Salyzyn2017-03-09 11:36:19 -0600
commit2ed51d708eda64516ec79ac6397f690de38f0075 (patch)
tree9ea938a4ee0461c443dc99e197827fc36ecd643b /liblog/logger_name.c
parentc1b3c8ef2629eac2a73aa4a95bf43a66edf4cd0f (diff)
downloadplatform-system-core-2ed51d708eda64516ec79ac6397f690de38f0075.tar.gz
platform-system-core-2ed51d708eda64516ec79ac6397f690de38f0075.tar.xz
platform-system-core-2ed51d708eda64516ec79ac6397f690de38f0075.zip
liblog: specify clang format
Switch coding style to match SideEffects: None Test: compile Bug: 27405083 Change-Id: Id426d5c5e3b18f2ceec22b31bbc9781aabf6bcca
Diffstat (limited to 'liblog/logger_name.c')
-rw-r--r--liblog/logger_name.c66
1 files changed, 33 insertions, 33 deletions
diff --git a/liblog/logger_name.c b/liblog/logger_name.c
index 5c4feaf32..a5a83e05a 100644
--- a/liblog/logger_name.c
+++ b/liblog/logger_name.c
@@ -21,44 +21,44 @@
21#include "log_portability.h" 21#include "log_portability.h"
22 22
23/* In the future, we would like to make this list extensible */ 23/* In the future, we would like to make this list extensible */
24static const char *LOG_NAME[LOG_ID_MAX] = { 24static const char* LOG_NAME[LOG_ID_MAX] = {
25 [LOG_ID_MAIN] = "main", 25 /* clang-format off */
26 [LOG_ID_RADIO] = "radio", 26 [LOG_ID_MAIN] = "main",
27 [LOG_ID_EVENTS] = "events", 27 [LOG_ID_RADIO] = "radio",
28 [LOG_ID_SYSTEM] = "system", 28 [LOG_ID_EVENTS] = "events",
29 [LOG_ID_CRASH] = "crash", 29 [LOG_ID_SYSTEM] = "system",
30 [LOG_ID_SECURITY] = "security", 30 [LOG_ID_CRASH] = "crash",
31 [LOG_ID_KERNEL] = "kernel", 31 [LOG_ID_SECURITY] = "security",
32 [LOG_ID_KERNEL] = "kernel",
33 /* clang-format on */
32}; 34};
33 35
34LIBLOG_ABI_PUBLIC const char *android_log_id_to_name(log_id_t log_id) 36LIBLOG_ABI_PUBLIC const char* android_log_id_to_name(log_id_t log_id) {
35{ 37 if (log_id >= LOG_ID_MAX) {
36 if (log_id >= LOG_ID_MAX) { 38 log_id = LOG_ID_MAIN;
37 log_id = LOG_ID_MAIN; 39 }
38 } 40 return LOG_NAME[log_id];
39 return LOG_NAME[log_id];
40} 41}
41 42
42LIBLOG_ABI_PUBLIC log_id_t android_name_to_log_id(const char *logName) 43LIBLOG_ABI_PUBLIC log_id_t android_name_to_log_id(const char* logName) {
43{ 44 const char* b;
44 const char *b; 45 int ret;
45 int ret;
46 46
47 if (!logName) { 47 if (!logName) {
48 return -1; /* NB: log_id_t is unsigned */ 48 return -1; /* NB: log_id_t is unsigned */
49 } 49 }
50 b = strrchr(logName, '/'); 50 b = strrchr(logName, '/');
51 if (!b) { 51 if (!b) {
52 b = logName; 52 b = logName;
53 } else { 53 } else {
54 ++b; 54 ++b;
55 } 55 }
56 56
57 for(ret = LOG_ID_MIN; ret < LOG_ID_MAX; ++ret) { 57 for (ret = LOG_ID_MIN; ret < LOG_ID_MAX; ++ret) {
58 const char *l = LOG_NAME[ret]; 58 const char* l = LOG_NAME[ret];
59 if (l && !strcmp(b, l)) { 59 if (l && !strcmp(b, l)) {
60 return ret; 60 return ret;
61 }
62 } 61 }
63 return -1; /* should never happen */ 62 }
63 return -1; /* should never happen */
64} 64}