Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 04bbc8ea authored by Mark Salyzyn's avatar Mark Salyzyn
Browse files

liblog: stay away from C++ keyword private

Replace with void* private with priv in context structure.

SideEffects: None
Test: gTest liblog-unit-tests
Bug: 27405083
Change-Id: I670cb0b7fb2f3085ea13b4ac836d84239a3c8572
parent 2ed51d70
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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,
+1 −1
Original line number Diff line number Diff line
@@ -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,
+1 −1
Original line number Diff line number Diff line
@@ -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;
+6 −6
Original line number Diff line number Diff line
@@ -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,
@@ -74,7 +74,7 @@ static int stderrOpen() {
    return -EBADF;
  }

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

@@ -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;
@@ -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;