Skip to content

Commit 3195610

Browse files
committed
[NFC][sanitizer] Reorder functions in cpp file
1 parent 1f2492b commit 3195610

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_common_libcdep.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -86,26 +86,6 @@ void *BackgroundThread(void *arg) {
8686
}
8787
#endif
8888

89-
void WriteToSyslog(const char *msg) {
90-
InternalScopedString msg_copy;
91-
msg_copy.append("%s", msg);
92-
const char *p = msg_copy.data();
93-
94-
// Print one line at a time.
95-
// syslog, at least on Android, has an implicit message length limit.
96-
while (char* q = internal_strchr(p, '\n')) {
97-
*q = '\0';
98-
WriteOneLineToSyslog(p);
99-
p = q + 1;
100-
}
101-
// Print remaining characters, if there are any.
102-
// Note that this will add an extra newline at the end.
103-
// FIXME: buffer extra output. This would need a thread-local buffer, which
104-
// on Android requires plugging into the tools (ex. ASan's) Thread class.
105-
if (*p)
106-
WriteOneLineToSyslog(p);
107-
}
108-
10989
void MaybeStartBackgroudThread() {
11090
#if (SANITIZER_LINUX || SANITIZER_NETBSD) && \
11191
!SANITIZER_GO // Need to implement/test on other platforms.
@@ -126,6 +106,26 @@ void MaybeStartBackgroudThread() {
126106
#endif
127107
}
128108

109+
void WriteToSyslog(const char *msg) {
110+
InternalScopedString msg_copy;
111+
msg_copy.append("%s", msg);
112+
const char *p = msg_copy.data();
113+
114+
// Print one line at a time.
115+
// syslog, at least on Android, has an implicit message length limit.
116+
while (char* q = internal_strchr(p, '\n')) {
117+
*q = '\0';
118+
WriteOneLineToSyslog(p);
119+
p = q + 1;
120+
}
121+
// Print remaining characters, if there are any.
122+
// Note that this will add an extra newline at the end.
123+
// FIXME: buffer extra output. This would need a thread-local buffer, which
124+
// on Android requires plugging into the tools (ex. ASan's) Thread class.
125+
if (*p)
126+
WriteOneLineToSyslog(p);
127+
}
128+
129129
static void (*sandboxing_callback)();
130130
void SetSandboxingCallback(void (*f)()) {
131131
sandboxing_callback = f;

0 commit comments

Comments
 (0)