This is an automated email from the ASF dual-hosted git repository.

masaori pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new a727dcc361 Fix example plugins build (#10326)
a727dcc361 is described below

commit a727dcc3617532f12aa89a109ce43cc4c38893f8
Author: Masaori Koshiba <masa...@apache.org>
AuthorDate: Mon Sep 4 14:18:47 2023 +0900

    Fix example plugins build (#10326)
---
 .../plugins/plugin-management/logging-api.en.rst           |  4 ++--
 example/plugins/c-api/denylist_1/denylist_1.cc             | 10 +++++-----
 example/plugins/c-api/thread_pool/psi.cc                   | 14 +++++++-------
 src/traffic_server/InkAPITest.cc                           | 10 +++++-----
 4 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/doc/developer-guide/plugins/plugin-management/logging-api.en.rst 
b/doc/developer-guide/plugins/plugin-management/logging-api.en.rst
index bcca4931ce..7bb017d14a 100644
--- a/doc/developer-guide/plugins/plugin-management/logging-api.en.rst
+++ b/doc/developer-guide/plugins/plugin-management/logging-api.en.rst
@@ -65,14 +65,14 @@ The steps below show how the logging API is used in the
 
    .. code-block:: c
 
-         static TSTextLogObject log;
+         static TSTextLogObject ts_log;
 
 #. In ``TSPluginInit``, a new log object is allocated:
 
    .. code-block:: c
 
            TSReturnCode error = TSTextLogObjectCreate("denylist",
-                                TS_LOG_MODE_ADD_TIMESTAMP, &log);
+                                TS_LOG_MODE_ADD_TIMESTAMP, &ts_log);
 
    The new log is named ``denylist.log``. Each entry written to the log
    will have a timestamp. The ``nullptr`` argument specifies that the new
diff --git a/example/plugins/c-api/denylist_1/denylist_1.cc 
b/example/plugins/c-api/denylist_1/denylist_1.cc
index fca46db433..ce1883a506 100644
--- a/example/plugins/c-api/denylist_1/denylist_1.cc
+++ b/example/plugins/c-api/denylist_1/denylist_1.cc
@@ -35,7 +35,7 @@
 static char *sites[MAX_NSITES];
 static int nsites;
 static TSMutex sites_mutex;
-static TSTextLogObject log;
+static TSTextLogObject ts_log;
 static TSCont global_contp;
 
 static void handle_txn_start(TSCont contp, TSHttpTxn txnp);
@@ -108,8 +108,8 @@ handle_dns(TSHttpTxn txnp, TSCont contp)
 
   for (i = 0; i < nsites; i++) {
     if (strncmp(host, sites[i], host_length) == 0) {
-      if (log) {
-        TSTextLogObjectWrite(log, "denylisting site: %s", sites[i]);
+      if (ts_log) {
+        TSTextLogObjectWrite(ts_log, "denylisting site: %s", sites[i]);
       } else {
         TSDebug(PLUGIN_NAME, "denylisting site: %s", sites[i]);
       }
@@ -322,8 +322,8 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] 
ATS_UNUSED)
   }
 
   /* create an TSTextLogObject to log denied requests to */
-  error = TSTextLogObjectCreate("denylist", TS_LOG_MODE_ADD_TIMESTAMP, &log);
-  if (!log || error == TS_ERROR) {
+  error = TSTextLogObjectCreate("denylist", TS_LOG_MODE_ADD_TIMESTAMP, 
&ts_log);
+  if (!ts_log || error == TS_ERROR) {
     TSDebug(PLUGIN_NAME, "error while creating log");
   }
 
diff --git a/example/plugins/c-api/thread_pool/psi.cc 
b/example/plugins/c-api/thread_pool/psi.cc
index 21a38670f1..499a935182 100644
--- a/example/plugins/c-api/thread_pool/psi.cc
+++ b/example/plugins/c-api/thread_pool/psi.cc
@@ -100,7 +100,7 @@ typedef enum {
 
 extern Queue job_queue;
 
-static TSTextLogObject log;
+static TSTextLogObject ts_log;
 static char psi_directory[PSI_PATH_MAX_SIZE];
 
 static int trylock_handler(TSCont contp, TSEvent event, void *edata);
@@ -499,13 +499,13 @@ psi_include(TSCont contp, void *edata ATS_UNUSED)
     }
     TSfclose(filep);
     data->psi_success = 1;
-    if (log) {
-      TSTextLogObjectWrite(log, "Successfully included file: %s", inc_file);
+    if (ts_log) {
+      TSTextLogObjectWrite(ts_log, "Successfully included file: %s", inc_file);
     }
   } else {
     data->psi_success = 0;
-    if (log) {
-      TSTextLogObjectWrite(log, "Failed to include file: %s", inc_file);
+    if (ts_log) {
+      TSTextLogObjectWrite(ts_log, "Failed to include file: %s", inc_file);
     }
   }
 
@@ -972,10 +972,10 @@ TSPluginInit(int argc ATS_UNUSED, const char *argv[] 
ATS_UNUSED)
   snprintf(psi_directory, sizeof(psi_directory), "%s/%s", TSPluginDirGet(), 
PSI_PATH);
 
   /* create an TSTextLogObject to log any psi include */
-  retval = TSTextLogObjectCreate("psi", TS_LOG_MODE_ADD_TIMESTAMP, &log);
+  retval = TSTextLogObjectCreate("psi", TS_LOG_MODE_ADD_TIMESTAMP, &ts_log);
   if (retval == TS_ERROR) {
     TSError("[%s] Failed creating log for psi plugin", PLUGIN_NAME);
-    log = nullptr;
+    ts_log = nullptr;
   }
 
   /* Create working threads */
diff --git a/src/traffic_server/InkAPITest.cc b/src/traffic_server/InkAPITest.cc
index bb7f986da0..b07b02fd8f 100644
--- a/src/traffic_server/InkAPITest.cc
+++ b/src/traffic_server/InkAPITest.cc
@@ -6462,7 +6462,7 @@ REGRESSION_TEST(SDK_API_TSTextLog)(RegressionTest *test, 
int /* atype ATS_UNUSED
 {
   *pstatus = REGRESSION_TEST_INPROGRESS;
 
-  TSTextLogObject log;
+  TSTextLogObject ts_log;
   TSReturnCode retVal;
 
   char logname[PATH_NAME_MAX];
@@ -6475,7 +6475,7 @@ REGRESSION_TEST(SDK_API_TSTextLog)(RegressionTest *test, 
int /* atype ATS_UNUSED
   snprintf(fullpath_logname, sizeof(fullpath_logname), "%s/%s", (const char 
*)tmp, logname);
 
   unlink(fullpath_logname);
-  retVal = TSTextLogObjectCreate(logname, TS_LOG_MODE_ADD_TIMESTAMP, &log);
+  retVal = TSTextLogObjectCreate(logname, TS_LOG_MODE_ADD_TIMESTAMP, &ts_log);
   if (retVal != TS_SUCCESS) {
     SDK_RPRINT(test, "TSTextLogObjectCreate", "TestCase1", TC_FAIL, "can not 
create log object");
     *pstatus = REGRESSION_TEST_FAILED;
@@ -6484,7 +6484,7 @@ REGRESSION_TEST(SDK_API_TSTextLog)(RegressionTest *test, 
int /* atype ATS_UNUSED
     SDK_RPRINT(test, "TSTextLogObjectCreate", "TestCase1", TC_PASS, "ok");
   }
 
-  retVal = TSTextLogObjectWrite(log, (char *)LOG_TEST_PATTERN);
+  retVal = TSTextLogObjectWrite(ts_log, (char *)LOG_TEST_PATTERN);
   if (retVal != TS_SUCCESS) {
     SDK_RPRINT(test, "TSTextLogObjectWrite", "TestCase1", TC_FAIL, "can not 
write to log object");
     *pstatus = REGRESSION_TEST_FAILED;
@@ -6493,7 +6493,7 @@ REGRESSION_TEST(SDK_API_TSTextLog)(RegressionTest *test, 
int /* atype ATS_UNUSED
     SDK_RPRINT(test, "TSTextLogObjectWrite", "TestCase1", TC_PASS, "ok");
   }
 
-  TSTextLogObjectFlush(log);
+  TSTextLogObjectFlush(ts_log);
   SDK_RPRINT(test, "TSTextLogObjectFlush", "TestCase1", TC_PASS, "ok");
 
   TSCont log_test_cont   = TSContCreate(log_test_handler, TSMutexCreate());
@@ -6502,7 +6502,7 @@ REGRESSION_TEST(SDK_API_TSTextLog)(RegressionTest *test, 
int /* atype ATS_UNUSED
   data->pstatus          = pstatus;
   data->fullpath_logname = TSstrdup(fullpath_logname);
   data->magic            = MAGIC_ALIVE;
-  data->log              = log;
+  data->log              = ts_log;
   TSContDataSet(log_test_cont, data);
 
   TSContScheduleOnPool(log_test_cont, 6000, TS_THREAD_POOL_NET);

Reply via email to