You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by sw...@apache.org on 2023/12/06 06:10:49 UTC

(logging-log4cxx) branch apr_cleanup created (now 95e0cffd)

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

swebb2066 pushed a change to branch apr_cleanup
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git


      at 95e0cffd Remove unused references to APR

This branch includes the following new commits:

     new 95e0cffd Remove unused references to APR

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(logging-log4cxx) 01/01: Remove unused references to APR

Posted by sw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

swebb2066 pushed a commit to branch apr_cleanup
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git

commit 95e0cffd0be53a571636c6b7ff3ead2e06ef17f9
Author: Stephen Webb <sw...@gmail.com>
AuthorDate: Wed Dec 6 16:51:13 2023 +1100

    Remove unused references to APR
---
 src/main/cpp/aprinitializer.cpp                   |  3 ---
 src/main/cpp/asyncappender.cpp                    |  4 ----
 src/main/cpp/cacheddateformat.cpp                 |  5 +----
 src/main/cpp/datagramsocket.cpp                   |  3 ---
 src/main/cpp/filewatchdog.cpp                     |  4 +---
 src/main/cpp/htmllayout.cpp                       |  3 ---
 src/main/cpp/multiprocessrollingfileappender.cpp  |  1 -
 src/main/cpp/optionconverter.cpp                  |  1 -
 src/main/cpp/relativetimedateformat.cpp           |  5 +----
 src/main/cpp/telnetappender.cpp                   |  3 ---
 src/main/include/log4cxx/helpers/aprinitializer.h |  1 -
 src/test/cpp/helpers/charsetencodertestcase.cpp   | 14 +++++++++-----
 12 files changed, 12 insertions(+), 35 deletions(-)

diff --git a/src/main/cpp/aprinitializer.cpp b/src/main/cpp/aprinitializer.cpp
index 58c44fad..4a72371f 100644
--- a/src/main/cpp/aprinitializer.cpp
+++ b/src/main/cpp/aprinitializer.cpp
@@ -20,10 +20,8 @@
 #endif
 #include <log4cxx/helpers/aprinitializer.h>
 #include <apr_pools.h>
-#include <apr_atomic.h>
 #include <assert.h>
 #include <log4cxx/helpers/threadspecificdata.h>
-#include <apr_thread_mutex.h>
 #include <apr_thread_proc.h>
 #include <apr_dbd.h>
 #include <log4cxx/helpers/filewatchdog.h>
@@ -87,7 +85,6 @@ APRInitializer::APRInitializer() :
 	m_priv(std::make_unique<APRInitializerPrivate>())
 {
 	apr_pool_create(&m_priv->p, NULL);
-	apr_atomic_init(m_priv->p);
 	m_priv->startTime = Date::currentTime();
 #if APR_HAS_THREADS
 	apr_status_t stat = apr_threadkey_private_create(&m_priv->tlsKey, tlsDestructImpl, m_priv->p);
diff --git a/src/main/cpp/asyncappender.cpp b/src/main/cpp/asyncappender.cpp
index 228e1b8c..fde3fd6e 100644
--- a/src/main/cpp/asyncappender.cpp
+++ b/src/main/cpp/asyncappender.cpp
@@ -21,11 +21,7 @@
 
 #include <log4cxx/helpers/loglog.h>
 #include <log4cxx/spi/loggingevent.h>
-#include <apr_thread_proc.h>
-#include <apr_thread_mutex.h>
-#include <apr_thread_cond.h>
 #include <log4cxx/helpers/stringhelper.h>
-#include <apr_atomic.h>
 #include <log4cxx/helpers/optionconverter.h>
 #include <log4cxx/helpers/threadutility.h>
 #include <log4cxx/private/appenderskeleton_priv.h>
diff --git a/src/main/cpp/cacheddateformat.cpp b/src/main/cpp/cacheddateformat.cpp
index 0447064d..197f94cf 100644
--- a/src/main/cpp/cacheddateformat.cpp
+++ b/src/main/cpp/cacheddateformat.cpp
@@ -18,9 +18,6 @@
 #define NOMINMAX /* tell wnidows not to define min/max macros */
 #include <log4cxx/logstring.h>
 #include <log4cxx/helpers/cacheddateformat.h>
-
-
-#include <apr_time.h>
 #include <log4cxx/helpers/pool.h>
 #include <limits>
 #include <log4cxx/helpers/exception.h>
@@ -158,7 +155,7 @@ int CachedDateFormat::findMillisecondStart(
 	Pool& pool)
 {
 
-	apr_time_t slotBegin = (time / 1000000) * 1000000;
+	log4cxx_time_t slotBegin = (time / 1000000) * 1000000;
 
 	if (slotBegin > time)
 	{
diff --git a/src/main/cpp/datagramsocket.cpp b/src/main/cpp/datagramsocket.cpp
index 24172c41..7df81ae4 100644
--- a/src/main/cpp/datagramsocket.cpp
+++ b/src/main/cpp/datagramsocket.cpp
@@ -22,9 +22,6 @@
 #include <log4cxx/private/datagramsocket_priv.h>
 #include <log4cxx/private/aprdatagramsocket.h>
 
-#include "apr_network_io.h"
-#include "apr_lib.h"
-
 using namespace LOG4CXX_NS::helpers;
 
 IMPLEMENT_LOG4CXX_OBJECT(DatagramSocket)
diff --git a/src/main/cpp/filewatchdog.cpp b/src/main/cpp/filewatchdog.cpp
index 45ea3941..c31363b0 100644
--- a/src/main/cpp/filewatchdog.cpp
+++ b/src/main/cpp/filewatchdog.cpp
@@ -18,8 +18,6 @@
 #include <log4cxx/logstring.h>
 #include <log4cxx/helpers/filewatchdog.h>
 #include <log4cxx/helpers/loglog.h>
-#include <apr_thread_proc.h>
-#include <apr_atomic.h>
 #include <log4cxx/helpers/transcoder.h>
 #include <log4cxx/helpers/exception.h>
 #include <log4cxx/helpers/threadutility.h>
@@ -109,7 +107,7 @@ void FileWatchdog::checkAndConfigure()
 	}
 	else
 	{
-		apr_time_t thisMod = m_priv->file.lastModified(pool1);
+		auto thisMod = m_priv->file.lastModified(pool1);
 
 		if (thisMod > m_priv->lastModif)
 		{
diff --git a/src/main/cpp/htmllayout.cpp b/src/main/cpp/htmllayout.cpp
index 7b1f46ad..c2411ece 100644
--- a/src/main/cpp/htmllayout.cpp
+++ b/src/main/cpp/htmllayout.cpp
@@ -26,9 +26,6 @@
 #include <log4cxx/helpers/transcoder.h>
 #include <log4cxx/helpers/date.h>
 
-#include <apr_strings.h>
-#include <string.h>
-
 using namespace LOG4CXX_NS;
 using namespace LOG4CXX_NS::helpers;
 using namespace LOG4CXX_NS::spi;
diff --git a/src/main/cpp/multiprocessrollingfileappender.cpp b/src/main/cpp/multiprocessrollingfileappender.cpp
index a78d10f1..a29b0c6d 100644
--- a/src/main/cpp/multiprocessrollingfileappender.cpp
+++ b/src/main/cpp/multiprocessrollingfileappender.cpp
@@ -17,7 +17,6 @@
 
 #include <apr_portable.h>
 #include <apr_file_io.h>
-#include <apr_atomic.h>
 #include <apr_mmap.h>
 #ifndef MAX_FILE_LEN
 	#define MAX_FILE_LEN 2048
diff --git a/src/main/cpp/optionconverter.cpp b/src/main/cpp/optionconverter.cpp
index 54290730..cfd1af57 100644
--- a/src/main/cpp/optionconverter.cpp
+++ b/src/main/cpp/optionconverter.cpp
@@ -37,7 +37,6 @@
 #include <log4cxx/file.h>
 #include <log4cxx/xml/domconfigurator.h>
 #include <log4cxx/logmanager.h>
-#include <apr_general.h>
 #if !defined(LOG4CXX)
 	#define LOG4CXX 1
 #endif
diff --git a/src/main/cpp/relativetimedateformat.cpp b/src/main/cpp/relativetimedateformat.cpp
index 49d09059..612460b6 100644
--- a/src/main/cpp/relativetimedateformat.cpp
+++ b/src/main/cpp/relativetimedateformat.cpp
@@ -18,9 +18,6 @@
 #include <log4cxx/logstring.h>
 #include <log4cxx/helpers/relativetimedateformat.h>
 #include <log4cxx/spi/loggingevent.h>
-
-#include <apr.h>
-#include <apr_time.h>
 #include <log4cxx/helpers/stringhelper.h>
 
 
@@ -34,6 +31,6 @@ void LOG4CXX_NS::helpers::RelativeTimeDateFormat::format(
 	log4cxx_time_t date,
 	Pool& p) const
 {
-	int64_t interval = (date - startTime) / APR_INT64_C(1000);
+	int64_t interval = (date - startTime) / int64_t(1000);
 	StringHelper::toString(interval, p, s);
 }
diff --git a/src/main/cpp/telnetappender.cpp b/src/main/cpp/telnetappender.cpp
index b8f6ab89..6977e3a3 100644
--- a/src/main/cpp/telnetappender.cpp
+++ b/src/main/cpp/telnetappender.cpp
@@ -19,9 +19,6 @@
 #include <log4cxx/helpers/loglog.h>
 #include <log4cxx/helpers/optionconverter.h>
 #include <log4cxx/helpers/stringhelper.h>
-#include <apr_thread_proc.h>
-#include <apr_atomic.h>
-#include <apr_strings.h>
 #include <log4cxx/helpers/charsetencoder.h>
 #include <log4cxx/helpers/bytebuffer.h>
 #include <log4cxx/helpers/threadutility.h>
diff --git a/src/main/include/log4cxx/helpers/aprinitializer.h b/src/main/include/log4cxx/helpers/aprinitializer.h
index adbe5d10..2db4c4d4 100644
--- a/src/main/include/log4cxx/helpers/aprinitializer.h
+++ b/src/main/include/log4cxx/helpers/aprinitializer.h
@@ -28,7 +28,6 @@
 #include <log4cxx/helpers/widelife.h>
 
 extern "C" {
-	typedef struct apr_thread_mutex_t apr_thread_mutex_t;
 	typedef struct apr_threadkey_t apr_threadkey_t;
 	struct apr_pool_t;
 }
diff --git a/src/test/cpp/helpers/charsetencodertestcase.cpp b/src/test/cpp/helpers/charsetencodertestcase.cpp
index 65bac6a7..c71d91ba 100644
--- a/src/test/cpp/helpers/charsetencodertestcase.cpp
+++ b/src/test/cpp/helpers/charsetencodertestcase.cpp
@@ -22,7 +22,7 @@
 #include <log4cxx/helpers/transcoder.h>
 #include <log4cxx/helpers/loglog.h>
 #include <apr.h>
-#include <apr_atomic.h>
+#include <apr_errno.h>
 #include <condition_variable>
 #include <thread>
 
@@ -257,22 +257,26 @@ public:
 
 			void fail()
 			{
-				apr_atomic_inc32(&failCount);
+				std::unique_lock<std::mutex> sync(lock);
+				++failCount;
 			}
 
 			void pass()
 			{
-				apr_atomic_inc32(&passCount);
+				std::unique_lock<std::mutex> sync(lock);
+				++passCount;
 			}
 
 			apr_uint32_t getFail()
 			{
-				return apr_atomic_read32(&failCount);
+				std::unique_lock<std::mutex> sync(lock);
+				return failCount;
 			}
 
 			apr_uint32_t getPass()
 			{
-				return apr_atomic_read32(&passCount);
+				std::unique_lock<std::mutex> sync(lock);
+				return passCount;
 			}
 
 			int getRepetitions()