Merge "Remove liblog's rate limiting"
diff --git a/liblog/config_read.h b/liblog/config_read.h
index 7b29fa4..00ea453 100644
--- a/liblog/config_read.h
+++ b/liblog/config_read.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef _LIBLOG_CONFIG_READ_H__
-#define _LIBLOG_CONFIG_READ_H__
+#pragma once
#include <cutils/list.h>
@@ -51,5 +50,3 @@
LIBLOG_HIDDEN void __android_log_config_read_close();
__END_DECLS
-
-#endif /* _LIBLOG_CONFIG_READ_H__ */
diff --git a/liblog/config_write.h b/liblog/config_write.h
index db1a083..e3be445 100644
--- a/liblog/config_write.h
+++ b/liblog/config_write.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef _LIBLOG_CONFIG_WRITE_H__
-#define _LIBLOG_CONFIG_WRITE_H__
+#pragma once
#include <cutils/list.h>
@@ -51,5 +50,3 @@
LIBLOG_HIDDEN void __android_log_config_write_close();
__END_DECLS
-
-#endif /* _LIBLOG_CONFIG_WRITE_H__ */
diff --git a/liblog/fake_log_device.h b/liblog/fake_log_device.h
index d88eaee..74d434e 100644
--- a/liblog/fake_log_device.h
+++ b/liblog/fake_log_device.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef _LIBLOG_FAKE_LOG_DEVICE_H
-#define _LIBLOG_FAKE_LOG_DEVICE_H
+#pragma once
#include <sys/types.h>
@@ -36,5 +35,3 @@
LIBLOG_ABI_PRIVATE int __android_log_is_debuggable();
__END_DECLS
-
-#endif // _LIBLOG_FAKE_LOG_DEVICE_H
diff --git a/liblog/include/log/event_tag_map.h b/liblog/include/log/event_tag_map.h
index 8dd9157..2687b3a 100644
--- a/liblog/include/log/event_tag_map.h
+++ b/liblog/include/log/event_tag_map.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef _LIBS_CUTILS_EVENTTAGMAP_H
-#define _LIBS_CUTILS_EVENTTAGMAP_H
+#pragma once
#ifdef __cplusplus
extern "C" {
@@ -69,5 +68,3 @@
#ifdef __cplusplus
}
#endif
-
-#endif /*_LIBS_CUTILS_EVENTTAGMAP_H*/
diff --git a/liblog/include/log/log.h b/liblog/include/log/log.h
index dc1e5cf..f63f480 100644
--- a/liblog/include/log/log.h
+++ b/liblog/include/log/log.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef _LIBS_LOG_LOG_H
-#define _LIBS_LOG_LOG_H
+#pragma once
/* Too many in the ecosystem assume these are included */
#if !defined(_WIN32)
@@ -173,5 +172,3 @@
#ifdef __cplusplus
}
#endif
-
-#endif /* _LIBS_LOG_LOG_H */
diff --git a/liblog/include/log/log_event_list.h b/liblog/include/log/log_event_list.h
index 4dd3de3..b376504 100644
--- a/liblog/include/log/log_event_list.h
+++ b/liblog/include/log/log_event_list.h
@@ -14,16 +14,13 @@
* limitations under the License.
*/
-#ifndef _LIBS_LOG_EVENT_LIST_H
-#define _LIBS_LOG_EVENT_LIST_H
+#pragma once
#include <errno.h>
#include <stdint.h>
-#if (defined(__cplusplus) && defined(_USING_LIBCXX))
-extern "C++" {
+#ifdef __cplusplus
#include <string>
-}
#endif
#include <log/log.h>
@@ -196,14 +193,12 @@
return *this;
}
-#if defined(_USING_LIBCXX)
android_log_event_list& operator<<(const std::string& value) {
int retval =
android_log_write_string8_len(ctx, value.data(), value.length());
if (retval < 0) ret = retval;
return *this;
}
-#endif
android_log_event_list& operator<<(float value) {
int retval = android_log_write_float32(ctx, value);
@@ -257,7 +252,6 @@
return ret >= 0;
}
-#if defined(_USING_LIBCXX)
bool AppendString(const std::string& value) {
int retval =
android_log_write_string8_len(ctx, value.data(), value.length());
@@ -271,7 +265,6 @@
if (retval < 0) ret = retval;
return ret;
}
-#endif
bool AppendFloat(float value) {
int retval = android_log_write_float32(ctx, value);
@@ -305,5 +298,3 @@
#ifdef __cplusplus
}
#endif
-
-#endif /* _LIBS_LOG_EVENT_LIST_H */
diff --git a/liblog/include/log/log_id.h b/liblog/include/log/log_id.h
index c44f5a2..c052a50 100644
--- a/liblog/include/log/log_id.h
+++ b/liblog/include/log/log_id.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef _LIBS_LOG_LOG_ID_H
-#define _LIBS_LOG_LOG_ID_H
+#pragma once
#ifdef __cplusplus
extern "C" {
@@ -62,5 +61,3 @@
#ifdef __cplusplus
}
#endif
-
-#endif /* _LIBS_LOG_LOG_ID_H */
diff --git a/liblog/include/log/log_main.h b/liblog/include/log/log_main.h
index a94a283..64791c2 100644
--- a/liblog/include/log/log_main.h
+++ b/liblog/include/log/log_main.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef _LIBS_LOG_LOG_MAIN_H
-#define _LIBS_LOG_LOG_MAIN_H
+#pragma once
#include <stdbool.h>
#include <sys/cdefs.h>
@@ -374,5 +373,3 @@
#endif
__END_DECLS
-
-#endif /* _LIBS_LOG_LOG_MAIN_H */
diff --git a/liblog/include/log/log_properties.h b/liblog/include/log/log_properties.h
index 94da242..3a8af6d 100644
--- a/liblog/include/log/log_properties.h
+++ b/liblog/include/log/log_properties.h
@@ -7,8 +7,7 @@
** General Public License.
*/
-#ifndef _LIBS_LOG_PROPERTIES_H
-#define _LIBS_LOG_PROPERTIES_H
+#pragma once
#ifdef __cplusplus
extern "C" {
@@ -19,5 +18,3 @@
#ifdef __cplusplus
}
#endif
-
-#endif /* _LIBS_LOG_PROPERTIES_H */
diff --git a/liblog/include/log/log_radio.h b/liblog/include/log/log_radio.h
index bd629fe..8b8a362 100644
--- a/liblog/include/log/log_radio.h
+++ b/liblog/include/log/log_radio.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef _LIBS_LOG_LOG_RADIO_H
-#define _LIBS_LOG_LOG_RADIO_H
+#pragma once
#include <android/log.h>
#include <log/log_id.h>
@@ -140,5 +139,3 @@
LOG_TAG, __VA_ARGS__)) \
: (void)0)
#endif
-
-#endif /* _LIBS_LOG_LOG_RADIO_H */
diff --git a/liblog/include/log/log_read.h b/liblog/include/log/log_read.h
index d6de930..fdef306 100644
--- a/liblog/include/log/log_read.h
+++ b/liblog/include/log/log_read.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef _LIBS_LOG_LOG_READ_H
-#define _LIBS_LOG_LOG_READ_H
+#pragma once
#include <sys/types.h>
@@ -246,5 +245,3 @@
#ifdef __cplusplus
}
#endif
-
-#endif /* _LIBS_LOG_LOG_H */
diff --git a/liblog/include/log/log_safetynet.h b/liblog/include/log/log_safetynet.h
index c8a5781..d3e9b19 100644
--- a/liblog/include/log/log_safetynet.h
+++ b/liblog/include/log/log_safetynet.h
@@ -7,8 +7,7 @@
** General Public License.
*/
-#ifndef _LIBS_LOG_SAFETYNET_H
-#define _LIBS_LOG_SAFETYNET_H
+#pragma once
#include <stdint.h>
@@ -28,5 +27,3 @@
#ifdef __cplusplus
}
#endif
-
-#endif /* _LIBS_LOG_SAFETYNET_H */
diff --git a/liblog/include/log/log_system.h b/liblog/include/log/log_system.h
index 3b5ae22..eaec741 100644
--- a/liblog/include/log/log_system.h
+++ b/liblog/include/log/log_system.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef _LIBS_LOG_LOG_SYSTEM_H
-#define _LIBS_LOG_LOG_SYSTEM_H
+#pragma once
#include <android/log.h>
#include <log/log_id.h>
@@ -138,5 +137,3 @@
LOG_TAG, __VA_ARGS__)) \
: (void)0)
#endif
-
-#endif /* _LIBS_LOG_LOG_SYSTEM_H */
diff --git a/liblog/include/log/log_time.h b/liblog/include/log/log_time.h
index 5830e6e..be69255 100644
--- a/liblog/include/log/log_time.h
+++ b/liblog/include/log/log_time.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef _LIBS_LOG_LOG_TIME_H
-#define _LIBS_LOG_LOG_TIME_H
+#pragma once
#include <stdint.h>
#include <time.h>
@@ -56,10 +55,8 @@
explicit log_time(uint32_t sec, uint32_t nsec = 0)
: tv_sec(sec), tv_nsec(nsec) {
}
-#ifdef _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_
#define __struct_log_time_private_defined
static const timespec EPOCH;
-#endif
log_time() {
}
#ifdef __linux__
@@ -105,7 +102,6 @@
return !(*this > T);
}
-#ifdef _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_
log_time operator-=(const timespec& T);
log_time operator-(const timespec& T) const {
log_time local(*this);
@@ -116,7 +112,6 @@
log_time local(*this);
return local += T;
}
-#endif
/* log_time */
bool operator==(const log_time& T) const {
@@ -140,7 +135,6 @@
return !(*this > T);
}
-#ifdef _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_
log_time operator-=(const log_time& T);
log_time operator-(const log_time& T) const {
log_time local(*this);
@@ -151,7 +145,6 @@
log_time local(*this);
return local += T;
}
-#endif
uint64_t nsec() const {
return static_cast<uint64_t>(tv_sec) * NS_PER_SEC + tv_nsec;
@@ -165,12 +158,10 @@
tv_nsec / (NS_PER_SEC / MS_PER_SEC);
}
-#ifdef _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_
static const char default_format[];
/* Add %#q for the fraction of a second to the standard library functions */
char* strptime(const char* s, const char* format = default_format);
-#endif
} __attribute__((__packed__));
}
@@ -184,5 +175,3 @@
#endif /* __cplusplus */
#endif /* __struct_log_time_defined */
-
-#endif /* _LIBS_LOG_LOG_TIME_H */
diff --git a/liblog/include/log/log_transport.h b/liblog/include/log/log_transport.h
index 8b02995..b48761a 100644
--- a/liblog/include/log/log_transport.h
+++ b/liblog/include/log/log_transport.h
@@ -7,8 +7,7 @@
** General Public License.
*/
-#ifndef _LIBS_LOG_TRANSPORT_H
-#define _LIBS_LOG_TRANSPORT_H
+#pragma once
#ifdef __cplusplus
extern "C" {
@@ -33,5 +32,3 @@
#ifdef __cplusplus
}
#endif
-
-#endif /* _LIBS_LOG_TRANSPORT_H */
diff --git a/liblog/include/log/logd.h b/liblog/include/log/logd.h
deleted file mode 100644
index 77400ca..0000000
--- a/liblog/include/log/logd.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef _LIBS_LOG_LOGD_H
-#define _LIBS_LOG_LOGD_H
-#include <log/log.h>
-#warning "Deprecated: do not include log/logd.h, use log/log.h instead"
-#endif /*_LIBS_LOG_LOGD_H*/
diff --git a/liblog/include/log/logger.h b/liblog/include/log/logger.h
deleted file mode 100644
index 1bf2d17..0000000
--- a/liblog/include/log/logger.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#ifndef _LIBS_LOG_LOGGER_H
-#define _LIBS_LOG_LOGGER_H
-#include <log/log.h>
-#warning "Deprecated: do not include log/logger.h, use log/log.h instead"
-#endif /*_LIBS_LOG_LOGGER_H*/
diff --git a/liblog/include/log/logprint.h b/liblog/include/log/logprint.h
index ca58bc7..8f4b187 100644
--- a/liblog/include/log/logprint.h
+++ b/liblog/include/log/logprint.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef _LOGPRINT_H
-#define _LOGPRINT_H
+#pragma once
#include <pthread.h>
@@ -158,5 +157,3 @@
#ifdef __cplusplus
}
#endif
-
-#endif /*_LOGPRINT_H*/
diff --git a/liblog/include/log/uio.h b/liblog/include/log/uio.h
index a492bae..7feb552 100644
--- a/liblog/include/log/uio.h
+++ b/liblog/include/log/uio.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef _LIBS_CUTILS_UIO_H
-#define _LIBS_CUTILS_UIO_H
+#pragma once
#if !defined(_WIN32)
@@ -46,5 +45,3 @@
#endif
#endif
-
-#endif /* _LIBS_UTILS_UIO_H */
diff --git a/liblog/include/private/android_logger.h b/liblog/include/private/android_logger.h
index b927b46..830f651 100644
--- a/liblog/include/private/android_logger.h
+++ b/liblog/include/private/android_logger.h
@@ -16,8 +16,7 @@
/* This file is used to define the internal protocol for the Android Logger */
-#ifndef _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_
-#define _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_
+#pragma once
/* Android private interfaces */
@@ -25,10 +24,8 @@
#include <stdint.h>
#include <sys/types.h>
-#if (defined(__cplusplus) && defined(_USING_LIBCXX))
-extern "C++" {
+#ifdef __cplusplus
#include <string>
-}
#endif
#include <log/log.h>
@@ -170,7 +167,6 @@
: android_log_event_list(log_msg) {
}
-#if defined(_USING_LIBCXX)
operator std::string() {
if (ret) return std::string("");
const char* cp = nullptr;
@@ -179,7 +175,6 @@
if (!cp || (len <= 0)) return std::string("");
return std::string(cp, len);
}
-#endif
};
}
#endif
@@ -189,5 +184,3 @@
#if defined(__cplusplus)
}
#endif
-
-#endif /* _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_ */
diff --git a/liblog/log_portability.h b/liblog/log_portability.h
index 4a1f59c..b9fb1d2 100644
--- a/liblog/log_portability.h
+++ b/liblog/log_portability.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef _LIBLOG_PORTABILITY_H__
-#define _LIBLOG_PORTABILITY_H__
+#pragma once
#include <sys/cdefs.h>
#include <unistd.h>
@@ -75,5 +74,3 @@
_rc; \
})
#endif
-
-#endif /* _LIBLOG_PORTABILITY_H__ */
diff --git a/liblog/logd_reader.h b/liblog/logd_reader.h
index 8ebb1ae..0bba7cf 100644
--- a/liblog/logd_reader.h
+++ b/liblog/logd_reader.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef _LIBLOG_LOGD_READER_H__
-#define _LIBLOG_LOGD_READER_H__
+#pragma once
#include <unistd.h>
@@ -26,5 +25,3 @@
LIBLOG_HIDDEN ssize_t __send_log_msg(char* buf, size_t buf_size);
__END_DECLS
-
-#endif /* _LIBLOG_LOGD_READER_H__ */
diff --git a/liblog/logger.h b/liblog/logger.h
index 7bb9b20..25ee065 100644
--- a/liblog/logger.h
+++ b/liblog/logger.h
@@ -14,8 +14,7 @@
* limitations under the License.
*/
-#ifndef _LIBLOG_LOGGER_H__
-#define _LIBLOG_LOGGER_H__
+#pragma once
#include <stdatomic.h>
#include <stdbool.h>
@@ -164,5 +163,3 @@
extern LIBLOG_HIDDEN int __android_log_transport;
__END_DECLS
-
-#endif /* _LIBLOG_LOGGER_H__ */
diff --git a/liblog/tests/Android.bp b/liblog/tests/Android.bp
index 2c47fd6..4ab2acb 100644
--- a/liblog/tests/Android.bp
+++ b/liblog/tests/Android.bp
@@ -29,10 +29,10 @@
"-fno-builtin",
],
shared_libs: [
- "liblog",
"libm",
"libbase",
],
+ static_libs: ["liblog"],
srcs: ["liblog_benchmark.cpp"],
}
@@ -63,10 +63,10 @@
"log_wrap_test.cpp",
],
shared_libs: [
- "liblog",
"libcutils",
"libbase",
],
+ static_libs: ["liblog"],
}
// Build tests for the device (with .so). Run with:
diff --git a/liblog/tests/log_time_test.cpp b/liblog/tests/log_time_test.cpp
index 0ae1d18..47fe594 100644
--- a/liblog/tests/log_time_test.cpp
+++ b/liblog/tests/log_time_test.cpp
@@ -21,12 +21,6 @@
#include <log/log_time.h>
TEST(liblog, log_time) {
-#ifdef _SYSTEM_CORE_INCLUDE_PRIVATE_ANDROID_LOGGER_H_
- log_time(CLOCK_MONOTONIC);
-
- EXPECT_EQ(log_time, log_time::EPOCH);
-#endif
-
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
log_time tl(ts);