diff options
author | Mark Salyzyn <salyzyn@google.com> | 2016-03-10 08:25:33 -0800 |
---|---|---|
committer | Mark Salyzyn <salyzyn@google.com> | 2016-03-10 13:49:38 -0800 |
commit | be1d3c21b57d3e67c6a9682f3b2f0838486a3ee8 (patch) | |
tree | f83e8dabebad833008a8618ebc40eef3d22d6c85 /liblog/logprint.c | |
parent | 76ffa683fc770ec75a66dbeae2c0ecaba905d97b (diff) | |
download | system_core-be1d3c21b57d3e67c6a9682f3b2f0838486a3ee8.tar.gz system_core-be1d3c21b57d3e67c6a9682f3b2f0838486a3ee8.tar.bz2 system_core-be1d3c21b57d3e67c6a9682f3b2f0838486a3ee8.zip |
liblog: audit declare LIBLOG_ABI_PUBLIC
- replace <sys/cdefs.h> with local "log_cdefs.h" which
fortifies and expands definitions, adding LIBLOG_ABI_PUBLIC,
LIBLOG_HIDDEN, LIBLOG_ABI_PRIVATE and LIBLOG_WEAK.
- clearly tag each interface as LIBLOG_ABI_PUBLIC, LIBLOG_HIDDEN,
LIBLOG_ABI_PRIVATE, LIBLOG_WEAK or static depending on scope
- Add -fvisibility=hidden to ensure nothing else leaks
- some code standard adjustments
Bug: 27566046
Change-Id: Ic14033c4e6d833d973beb035ddc1c6134fb35a3f
Diffstat (limited to 'liblog/logprint.c')
-rw-r--r-- | liblog/logprint.c | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/liblog/logprint.c b/liblog/logprint.c index 4ef62a1b7..19a3e2750 100644 --- a/liblog/logprint.c +++ b/liblog/logprint.c @@ -34,12 +34,11 @@ #include <log/logprint.h> #include <private/android_filesystem_config.h> +#include "log_cdefs.h" + #define MS_PER_NSEC 1000000 #define US_PER_NSEC 1000 -/* open coded fragment, prevent circular dependencies */ -#define WEAK static - typedef struct FilterInfo_t { char *mTag; android_LogPriority mPri; @@ -185,13 +184,15 @@ static android_LogPriority filterPriForTag( * returns 1 if this log line should be printed based on its priority * and tag, and 0 if it should not */ -int android_log_shouldPrintLine ( - AndroidLogFormat *p_format, const char *tag, android_LogPriority pri) +LIBLOG_ABI_PUBLIC int android_log_shouldPrintLine ( + AndroidLogFormat *p_format, + const char *tag, + android_LogPriority pri) { return pri >= filterPriForTag(p_format, tag); } -AndroidLogFormat *android_log_format_new() +LIBLOG_ABI_PUBLIC AndroidLogFormat *android_log_format_new() { AndroidLogFormat *p_ret; @@ -213,7 +214,7 @@ AndroidLogFormat *android_log_format_new() static list_declare(convertHead); -void android_log_format_free(AndroidLogFormat *p_format) +LIBLOG_ABI_PUBLIC void android_log_format_free(AndroidLogFormat *p_format) { FilterInfo *p_info, *p_info_old; @@ -236,7 +237,8 @@ void android_log_format_free(AndroidLogFormat *p_format) } } -int android_log_setPrintFormat(AndroidLogFormat *p_format, +LIBLOG_ABI_PUBLIC int android_log_setPrintFormat( + AndroidLogFormat *p_format, AndroidLogPrintFormat format) { switch (format) { @@ -277,7 +279,8 @@ static const char utc[] = "UTC"; /** * Returns FORMAT_OFF on invalid string */ -AndroidLogPrintFormat android_log_formatFromString(const char * formatString) +LIBLOG_ABI_PUBLIC AndroidLogPrintFormat android_log_formatFromString( + const char * formatString) { static AndroidLogPrintFormat format; @@ -341,7 +344,8 @@ AndroidLogPrintFormat android_log_formatFromString(const char * formatString) * Assumes single threaded execution */ -int android_log_addFilterRule(AndroidLogFormat *p_format, +LIBLOG_ABI_PUBLIC int android_log_addFilterRule( + AndroidLogFormat *p_format, const char *filterExpression) { size_t tagNameLength; @@ -419,7 +423,8 @@ error: * */ -int android_log_addFilterString(AndroidLogFormat *p_format, +LIBLOG_ABI_PUBLIC int android_log_addFilterString( + AndroidLogFormat *p_format, const char *filterString) { char *filterStringCopy = strdup (filterString); @@ -453,8 +458,9 @@ error: * Returns 0 on success and -1 on invalid wire format (entry will be * in unspecified state) */ -int android_log_processLogBuffer(struct logger_entry *buf, - AndroidLogEntry *entry) +LIBLOG_ABI_PUBLIC int android_log_processLogBuffer( + struct logger_entry *buf, + AndroidLogEntry *entry) { entry->tv_sec = buf->sec; entry->tv_nsec = buf->nsec; @@ -734,9 +740,11 @@ no_room: * it however we choose, which means we can't really use a fixed-size buffer * here. */ -int android_log_processBinaryLogBuffer(struct logger_entry *buf, - AndroidLogEntry *entry, const EventTagMap* map, char* messageBuf, - int messageBufLen) +LIBLOG_ABI_PUBLIC int android_log_processBinaryLogBuffer( + struct logger_entry *buf, + AndroidLogEntry *entry, + const EventTagMap *map, + char *messageBuf, int messageBufLen) { size_t inCount; unsigned int tagIndex; @@ -852,7 +860,7 @@ int android_log_processBinaryLogBuffer(struct logger_entry *buf, * _also_ be part of libutils/Unicode.cpp if its usefullness needs to * propagate globally. */ -WEAK ssize_t utf8_character_length(const char *src, size_t len) +LIBLOG_WEAK ssize_t utf8_character_length(const char *src, size_t len) { const char *cur = src; const char first_char = *cur++; @@ -956,7 +964,7 @@ static size_t convertPrintable(char *p, const char *message, size_t messageLen) return p - begin; } -char *readSeconds(char *e, struct timespec *t) +static char *readSeconds(char *e, struct timespec *t) { unsigned long multiplier; char *p; @@ -1243,12 +1251,12 @@ static void convertMonotonic(struct timespec *result, * Returns NULL on malloc error */ -char *android_log_formatLogLine ( - AndroidLogFormat *p_format, - char *defaultBuffer, - size_t defaultBufferSize, - const AndroidLogEntry *entry, - size_t *p_outLength) +LIBLOG_ABI_PUBLIC char *android_log_formatLogLine ( + AndroidLogFormat *p_format, + char *defaultBuffer, + size_t defaultBufferSize, + const AndroidLogEntry *entry, + size_t *p_outLength) { #if !defined(_WIN32) struct tm tmBuf; @@ -1526,10 +1534,10 @@ char *android_log_formatLogLine ( * Returns count bytes written */ -int android_log_printLogLine( - AndroidLogFormat *p_format, - int fd, - const AndroidLogEntry *entry) +LIBLOG_ABI_PUBLIC int android_log_printLogLine( + AndroidLogFormat *p_format, + int fd, + const AndroidLogEntry *entry) { int ret; char defaultBuffer[512]; |