Skip to content

Commit

Permalink
liblog: stay away from C++ keyword private
Browse files Browse the repository at this point in the history
Replace with void* private with priv in context structure.

SideEffects: None
Test: gTest liblog-unit-tests
Bug: 27405083
Change-Id: I670cb0b7fb2f3085ea13b4ac836d84239a3c8572
  • Loading branch information
Mark Salyzyn committed Mar 9, 2017
1 parent 2ed51d7 commit 04bbc8e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion liblog/fake_writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static int logFds[(int)LOG_ID_MAX] = { -1, -1, -1, -1, -1, -1 };

LIBLOG_HIDDEN struct android_log_transport_write fakeLoggerWrite = {
.node = { &fakeLoggerWrite.node, &fakeLoggerWrite.node },
.context.private = &logFds,
.context.priv = &logFds,
.name = "fake",
.available = NULL,
.open = fakeOpen,
Expand Down
2 changes: 1 addition & 1 deletion liblog/local_logger.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ static int writeToLocalWrite(log_id_t logId, struct timespec* ts,

LIBLOG_HIDDEN struct android_log_transport_write localLoggerWrite = {
.node = { &localLoggerWrite.node, &localLoggerWrite.node },
.context.private = NULL,
.context.priv = NULL,
.name = "local",
.available = writeToLocalAvailable,
.open = writeToLocalInit,
Expand Down
2 changes: 1 addition & 1 deletion liblog/logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ __BEGIN_DECLS

/* Union, sock or fd of zero is not allowed unless static initialized */
union android_log_context {
void* private;
void* priv;
atomic_int sock;
atomic_int fd;
struct listnode* node;
Expand Down
12 changes: 6 additions & 6 deletions liblog/stderr_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct stderrContext {

LIBLOG_HIDDEN struct android_log_transport_write stderrLoggerWrite = {
.node = { &stderrLoggerWrite.node, &stderrLoggerWrite.node },
.context.private = NULL,
.context.priv = NULL,
.name = "stderr",
.available = stderrAvailable,
.open = stderrOpen,
Expand All @@ -74,7 +74,7 @@ static int stderrOpen() {
return -EBADF;
}

if (stderrLoggerWrite.context.private) {
if (stderrLoggerWrite.context.priv) {
return fileno(stderr);
}

Expand Down Expand Up @@ -117,16 +117,16 @@ static int stderrOpen() {
if (envStr) {
android_log_addFilterString(ctx->logformat, envStr);
}
stderrLoggerWrite.context.private = ctx;
stderrLoggerWrite.context.priv = ctx;

return fileno(stderr);
}

static void stderrClose() {
struct stderrContext* ctx = stderrLoggerWrite.context.private;
struct stderrContext* ctx = stderrLoggerWrite.context.priv;

if (ctx) {
stderrLoggerWrite.context.private = NULL;
stderrLoggerWrite.context.priv = NULL;
if (ctx->logformat) {
android_log_format_free(ctx->logformat);
ctx->logformat = NULL;
Expand Down Expand Up @@ -154,7 +154,7 @@ static int stderrWrite(log_id_t logId, struct timespec* ts, struct iovec* vec,
char binaryMsgBuf[1024];
int err;
size_t i;
struct stderrContext* ctx = stderrLoggerWrite.context.private;
struct stderrContext* ctx = stderrLoggerWrite.context.priv;

if (!ctx) return -EBADF;
if (!vec || !nr) return -EINVAL;
Expand Down

0 comments on commit 04bbc8e

Please sign in to comment.