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 d388e7c  Fix directives for checking TS_HAS_TESTS
d388e7c is described below

commit d388e7ca820c00665cf38795fa4977a38d49f52c
Author: Masaori Koshiba <[email protected]>
AuthorDate: Wed Feb 27 09:38:17 2019 +0900

    Fix directives for checking TS_HAS_TESTS
---
 iocore/dns/DNS.cc           |  2 +-
 iocore/hostdb/HostDB.cc     |  2 +-
 iocore/net/SSLCertLookup.cc | 64 ++++++++++++++++++++++-----------------------
 proxy/Transform.cc          |  2 +-
 proxy/Transform.h           |  2 +-
 5 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/iocore/dns/DNS.cc b/iocore/dns/DNS.cc
index 6deb3dc..aae4c6b 100644
--- a/iocore/dns/DNS.cc
+++ b/iocore/dns/DNS.cc
@@ -1825,7 +1825,7 @@ ink_dns_init(ts::ModuleVersion v)
                      RecRawStatSyncSum);
 }
 
-#ifdef TS_HAS_TESTS
+#if TS_HAS_TESTS
 struct DNSRegressionContinuation;
 using DNSRegContHandler = int (DNSRegressionContinuation::*)(int, void *);
 
diff --git a/iocore/hostdb/HostDB.cc b/iocore/hostdb/HostDB.cc
index 5b81c85..73c8014 100644
--- a/iocore/hostdb/HostDB.cc
+++ b/iocore/hostdb/HostDB.cc
@@ -2286,7 +2286,7 @@ ParseHostFile(const char *path, unsigned int 
hostdb_hostfile_check_interval)
 // Regression tests
 //
 // Take a started hostDB and fill it up and make sure it doesn't explode
-#ifdef TS_HAS_TESTS
+#if TS_HAS_TESTS
 struct HostDBRegressionContinuation;
 
 struct HostDBRegressionContinuation : public Continuation {
diff --git a/iocore/net/SSLCertLookup.cc b/iocore/net/SSLCertLookup.cc
index 2b6e91d..bf6c1a0 100644
--- a/iocore/net/SSLCertLookup.cc
+++ b/iocore/net/SSLCertLookup.cc
@@ -311,38 +311,6 @@ make_to_lower_case(const char *name, char 
*lower_case_name, int buf_len)
   lower_case_name[i] = '\0';
 }
 
-static char *
-reverse_dns_name(const char *hostname, char (&reversed)[TS_MAX_HOST_NAME_LEN + 
1])
-{
-  char *ptr        = reversed + sizeof(reversed);
-  const char *part = hostname;
-
-  *(--ptr) = '\0'; // NUL-terminate
-
-  while (*part) {
-    ssize_t len    = strcspn(part, ".");
-    ssize_t remain = ptr - reversed;
-
-    if (remain < (len + 1)) {
-      return nullptr;
-    }
-
-    ptr -= len;
-    memcpy(ptr, part, len);
-
-    // Skip to the next domain component. This will take us to either a '.' or 
a NUL.
-    // If it's a '.' we need to skip over it.
-    part += len;
-    if (*part == '.') {
-      ++part;
-      *(--ptr) = '.';
-    }
-  }
-  make_to_lower_case(ptr, ptr, strlen(ptr) + 1);
-
-  return ptr;
-}
-
 SSLContextStorage::SSLContextStorage() {}
 
 bool
@@ -457,6 +425,38 @@ SSLContextStorage::lookup(const char *name)
 
 #if TS_HAS_TESTS
 
+static char *
+reverse_dns_name(const char *hostname, char (&reversed)[TS_MAX_HOST_NAME_LEN + 
1])
+{
+  char *ptr        = reversed + sizeof(reversed);
+  const char *part = hostname;
+
+  *(--ptr) = '\0'; // NUL-terminate
+
+  while (*part) {
+    ssize_t len    = strcspn(part, ".");
+    ssize_t remain = ptr - reversed;
+
+    if (remain < (len + 1)) {
+      return nullptr;
+    }
+
+    ptr -= len;
+    memcpy(ptr, part, len);
+
+    // Skip to the next domain component. This will take us to either a '.' or 
a NUL.
+    // If it's a '.' we need to skip over it.
+    part += len;
+    if (*part == '.') {
+      ++part;
+      *(--ptr) = '.';
+    }
+  }
+  make_to_lower_case(ptr, ptr, strlen(ptr) + 1);
+
+  return ptr;
+}
+
 REGRESSION_TEST(SSLWildcardMatch)(RegressionTest *t, int /* atype ATS_UNUSED 
*/, int *pstatus)
 {
   TestBox box(t, pstatus);
diff --git a/proxy/Transform.cc b/proxy/Transform.cc
index 37129d0..d15f18a 100644
--- a/proxy/Transform.cc
+++ b/proxy/Transform.cc
@@ -727,7 +727,7 @@ NullTransform::handle_event(int event, void *edata)
 /*-------------------------------------------------------------------------
   -------------------------------------------------------------------------*/
 
-#ifdef TS_HAS_TESTS
+#if TS_HAS_TESTS
 void
 TransformTest::run()
 {
diff --git a/proxy/Transform.h b/proxy/Transform.h
index 5789b98..5d2e3ed 100644
--- a/proxy/Transform.h
+++ b/proxy/Transform.h
@@ -48,7 +48,7 @@ public:
                                     int content_type_len, int64_t 
content_length);
 };
 
-#ifdef TS_HAS_TESTS
+#if TS_HAS_TESTS
 class TransformTest
 {
 public:

Reply via email to