subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bre...@apache.org
Subject svn commit: r1572303 - in /subversion/trunk: subversion/include/private/ subversion/libsvn_ra_serf/ subversion/libsvn_subr/ subversion/svnserve/ subversion/tests/libsvn_subr/ tools/server-side/
Date Wed, 26 Feb 2014 22:28:50 GMT
Author: breser
Date: Wed Feb 26 22:28:50 2014
New Revision: 1572303

URL: http://svn.apache.org/r1572303
Log:
Remove more compatability code for pre-1.3.x APR.

* subversion/include/private/svn_atomic.h
  (svn_atomic_t, svn_atomic_read, svn_atomic_set, svn_atomic_int,
   svn_atomic_dec, svn_atomic_cas): Assume the 32 bit versions of APR atomic
     functions are available.

* subversion/libsvn_ra_serf/commit.c
  (create_put_body): Always use apr_file_buffer_set().

* subversion/libsvn_ra_serf/update.c
  (body_done_fn): Always use apr_file_buffer_set().

* subversion/libsvn_subr/hash.c
  (svn_hash__clear): Remove the now unused function.

* subversion/libsvn_subr/io.c
  (svn_io_file_aligned_seek): Assume apr_file_buffer_set() is always available.

* subversion/libsvn_subr/utf.c
  (atomic_swap): Assume apr_atomic_xchangptr() is always available.

* subversion/svnserve/svnserve.c
  (HAVE_THREADPOOLS): Remove, we always have thread pools if we have threads.
  (THREAD_ERROR_MSG): Remove
  (serve_thread): Remove implementation that doesn't know about thread pools.
  (sub_main): Remove now unused tattr and tid local variables, assume we have
    thread pools if we have threads.
  (main): Assume we have thread pools if we have threads.

* subversion/tests/libsvn_subr/io-test.c
  (aligned_seek): Remove compat code for old versions of APR that were limited
    to 4k blocks.

* tools/server-side/fsfs-stats.c
  (get_content): Assume we can always use large read buffers.


Modified:
    subversion/trunk/subversion/include/private/svn_atomic.h
    subversion/trunk/subversion/libsvn_ra_serf/commit.c
    subversion/trunk/subversion/libsvn_ra_serf/update.c
    subversion/trunk/subversion/libsvn_subr/hash.c
    subversion/trunk/subversion/libsvn_subr/io.c
    subversion/trunk/subversion/libsvn_subr/utf.c
    subversion/trunk/subversion/svnserve/svnserve.c
    subversion/trunk/subversion/tests/libsvn_subr/io-test.c
    subversion/trunk/tools/server-side/fsfs-stats.c

Modified: subversion/trunk/subversion/include/private/svn_atomic.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_atomic.h?rev=1572303&r1=1572302&r2=1572303&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_atomic.h (original)
+++ subversion/trunk/subversion/include/private/svn_atomic.h Wed Feb 26 22:28:50 2014
@@ -46,39 +46,19 @@ extern "C" {
  */
 
 /** The type used by all the other atomic operations. */
-#if APR_VERSION_AT_LEAST(1, 0, 0)
 #define svn_atomic_t apr_uint32_t
-#else
-#define svn_atomic_t apr_atomic_t
-#endif
 
 /** Atomically read an #svn_atomic_t from memory. */
-#if APR_VERSION_AT_LEAST(1, 0, 0)
 #define svn_atomic_read(mem) apr_atomic_read32((mem))
-#else
-#define svn_atomic_read(mem) apr_atomic_read((mem))
-#endif
 
 /** Atomically set an #svn_atomic_t in memory. */
-#if APR_VERSION_AT_LEAST(1, 0, 0)
 #define svn_atomic_set(mem, val) apr_atomic_set32((mem), (val))
-#else
-#define svn_atomic_set(mem, val) apr_atomic_set((mem), (val))
-#endif
 
 /** Atomically increment an #svn_atomic_t. */
-#if APR_VERSION_AT_LEAST(1, 0, 0)
 #define svn_atomic_inc(mem) apr_atomic_inc32(mem)
-#else
-#define svn_atomic_inc(mem) apr_atomic_inc(mem)
-#endif
 
 /** Atomically decrement an #svn_atomic_t. */
-#if APR_VERSION_AT_LEAST(1, 0, 0)
 #define svn_atomic_dec(mem) apr_atomic_dec32(mem)
-#else
-#define svn_atomic_dec(mem) apr_atomic_dec(mem)
-#endif
 
 /**
  * Atomic compare-and-swap.
@@ -91,13 +71,8 @@ extern "C" {
  *       that on some platforms, the CAS function is implemented in a
  *       way that is incompatible with the other atomic operations.
  */
-#if APR_VERSION_AT_LEAST(1, 0, 0)
 #define svn_atomic_cas(mem, with, cmp) \
     apr_atomic_cas32((mem), (with), (cmp))
-#else
-#define svn_atomic_cas(mem, with, cmp) \
-    apr_atomic_cas((mem), (with), (cmp))
-#endif
 /** @} */
 
 /**

Modified: subversion/trunk/subversion/libsvn_ra_serf/commit.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/commit.c?rev=1572303&r1=1572302&r2=1572303&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/commit.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/commit.c Wed Feb 26 22:28:50 2014
@@ -954,9 +954,7 @@ create_put_body(serf_bucket_t **body_bkt
    * bucket for us on the buffered svndiff handle.
    */
   SVN_ERR(svn_io_file_flush(ctx->svndiff, pool));
-#if APR_VERSION_AT_LEAST(1, 3, 0)
   apr_file_buffer_set(ctx->svndiff, NULL, 0);
-#endif
   offset = 0;
   SVN_ERR(svn_io_file_seek(ctx->svndiff, APR_SET, &offset, pool));
 

Modified: subversion/trunk/subversion/libsvn_ra_serf/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_ra_serf/update.c?rev=1572303&r1=1572302&r2=1572303&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_ra_serf/update.c (original)
+++ subversion/trunk/subversion/libsvn_ra_serf/update.c Wed Feb 26 22:28:50 2014
@@ -570,9 +570,7 @@ body_done_fn(void *baton)
         */
 
       SVN_ERR(svn_io_file_flush(bcb->file, bcb->scratch_pool));
-#if APR_VERSION_AT_LEAST(1, 3, 0)
       apr_file_buffer_set(bcb->file, NULL, 0);
-#endif
     }
   else if (bcb->collect_bucket)
     bcb->all_data = body_allocate_all(bcb, bcb->result_pool);

Modified: subversion/trunk/subversion/libsvn_subr/hash.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/hash.c?rev=1572303&r1=1572302&r2=1572303&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/hash.c (original)
+++ subversion/trunk/subversion/libsvn_subr/hash.c Wed Feb 26 22:28:50 2014
@@ -559,23 +559,6 @@ svn_hash_from_cstring_keys(apr_hash_t **
 }
 
 
-#if !APR_VERSION_AT_LEAST(1, 3, 0)
-void
-svn_hash__clear(apr_hash_t *hash)
-{
-  apr_hash_index_t *hi;
-  const void *key;
-  apr_ssize_t klen;
-
-  for (hi = apr_hash_first(NULL, hash); hi; hi = apr_hash_next(hi))
-    {
-      apr_hash_this(hi, &key, &klen, NULL);
-      apr_hash_set(hash, key, klen, NULL);
-    }
-}
-#endif
-
-
 
 /*** Specialized getter APIs ***/
 

Modified: subversion/trunk/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/io.c?rev=1572303&r1=1572302&r2=1572303&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/io.c (original)
+++ subversion/trunk/subversion/libsvn_subr/io.c Wed Feb 26 22:28:50 2014
@@ -3578,8 +3578,6 @@ svn_io_file_aligned_seek(apr_file_t *fil
   if (block_size == 0)
     block_size = apr_default_buffer_size;
 
-  /* on old APRs, we are simply stuck with 4k blocks */
-#if APR_VERSION_AT_LEAST(1,3,0)
   file_buffer_size = apr_file_buffer_size_get(file);
 
   /* don't try to set a buffer size for non-buffered files! */
@@ -3600,7 +3598,6 @@ svn_io_file_aligned_seek(apr_file_t *fil
       fill_buffer = TRUE;
     }
   else
-#endif
     {
       aligned_offset = offset - (offset % file_buffer_size);
 

Modified: subversion/trunk/subversion/libsvn_subr/utf.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/utf.c?rev=1572303&r1=1572302&r2=1572303&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/utf.c (original)
+++ subversion/trunk/subversion/libsvn_subr/utf.c Wed Feb 26 22:28:50 2014
@@ -184,16 +184,10 @@ static APR_INLINE void*
 atomic_swap(void * volatile * mem, void *new_value)
 {
 #if APR_HAS_THREADS
-#if APR_VERSION_AT_LEAST(1,3,0)
   /* Cast is necessary because of APR bug:
      https://issues.apache.org/bugzilla/show_bug.cgi?id=50731 */
    return apr_atomic_xchgptr((volatile void **)mem, new_value);
 #else
-   /* old APRs don't support atomic swaps. Simply return the
-    * input to the caller for further proccessing. */
-   return new_value;
-#endif
-#else
    /* no threads - no sync. necessary */
    void *old_value = (void*)*mem;
    *mem = new_value;

Modified: subversion/trunk/subversion/svnserve/svnserve.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svnserve/svnserve.c?rev=1572303&r1=1572302&r2=1572303&view=diff
==============================================================================
--- subversion/trunk/subversion/svnserve/svnserve.c (original)
+++ subversion/trunk/subversion/svnserve/svnserve.c Wed Feb 26 22:28:50 2014
@@ -58,18 +58,8 @@
 #include "private/svn_mutex.h"
 #include "private/svn_subr_private.h"
 
-/* Alas! old APR-Utils don't provide thread pools */
 #if APR_HAS_THREADS
-#  if APR_VERSION_AT_LEAST(1,3,0)
 #    include <apr_thread_pool.h>
-#    define HAVE_THREADPOOLS 1
-#    define THREAD_ERROR_MSG _("Can't push task")
-#  else
-#    define HAVE_THREADPOOLS 0
-#    define THREAD_ERROR_MSG _("Can't create thread")
-#  endif
-#else
-#  define HAVE_THREADPOOLS 0
 #endif
 
 #include "winservice.h"
@@ -540,8 +530,6 @@ serve_socket(connection_t *connection,
    There should be at most THREADPOOL_MAX_SIZE such pools. */
 static svn_root_pools__t *connection_pools;
 
-#if HAVE_THREADPOOLS
-
 /* The global thread pool serving all connections. */
 static apr_thread_pool_t *threads;
 
@@ -586,26 +574,6 @@ static void * APR_THREAD_FUNC serve_thre
   return NULL;
 }
 
-#else
-
-/* Fully serve the connection given by DATA. */
-static void * APR_THREAD_FUNC serve_thread(apr_thread_t *tid, void *data)
-{
-  struct connection_t *connection = data;
-  apr_pool_t *pool = svn_root_pools__acquire_pool(connection_pools);
-
-  /* serve_socket() logs any error it returns, so ignore it. */
-  svn_error_clear(serve_socket(connection, pool));
-
-  svn_root_pools__release_pool(pool, connection_pools);
-
-  /* destroy the connection object */
-  close_connection(connection);
-
-  return NULL;
-}
-#endif
-
 #endif
 
 /* Write the PID of the current process as a decimal number, followed by a
@@ -668,10 +636,6 @@ sub_main(int *exit_code, int argc, const
 #ifndef WIN32
   apr_proc_t proc;
 #endif
-#if APR_HAS_THREADS && !HAVE_THREADPOOLS
-  apr_threadattr_t *tattr;
-  apr_thread_t *tid;
-#endif
   svn_boolean_t is_multi_threaded;
   enum connection_handling_mode handling_mode = CONNECTION_DEFAULT;
   apr_hash_t *fs_config = NULL;
@@ -1224,9 +1188,7 @@ sub_main(int *exit_code, int argc, const
 
 #if APR_HAS_THREADS
   SVN_ERR(svn_root_pools__create(&connection_pools));
-#endif
 
-#if HAVE_THREADPOOLS
   if (handling_mode == connection_mode_thread)
     {
       /* create the thread pool */
@@ -1295,26 +1257,11 @@ sub_main(int *exit_code, int argc, const
 #if APR_HAS_THREADS
           attach_connection(connection);
 
-#if HAVE_THREADPOOLS
           status = apr_thread_pool_push(threads, serve_thread, connection,
                                         0, NULL);
-#else
-          status = apr_threadattr_create(&tattr, connection->pool);
           if (status)
             {
-              return svn_error_wrap_apr(status, _("Can't create threadattr"));
-            }
-          status = apr_threadattr_detach_set(tattr, 1);
-          if (status)
-            {
-              return svn_error_wrap_apr(status, _("Can't set detached state"));
-            }
-          status = apr_thread_create(&tid, tattr, serve_thread, connection,
-                                     connection->pool);
-#endif
-          if (status)
-            {
-              return svn_error_wrap_apr(status, THREAD_ERROR_MSG);
+              return svn_error_wrap_apr(status, _("Can't push task"));
             }
 #endif
           break;
@@ -1357,7 +1304,7 @@ main(int argc, const char *argv[])
       svn_cmdline_handle_exit_error(err, NULL, "svnserve: ");
     }
 
-#if HAVE_THREADPOOLS
+#if APR_HAS_THREADS
   /* Explicitly wait for all threads to exit.  As we found out with similar
      code in our C test framework, the memory pool cleanup below cannot be
      trusted to do the right thing. */

Modified: subversion/trunk/subversion/tests/libsvn_subr/io-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/io-test.c?rev=1572303&r1=1572302&r2=1572303&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/io-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/io-test.c Wed Feb 26 22:28:50 2014
@@ -555,13 +555,8 @@ aligned_seek(apr_file_t *file,
    */
   if (buffered)
     {
-#if APR_VERSION_AT_LEAST(1,3,0)
       SVN_TEST_ASSERT(block_start % block_size == 0);
       SVN_TEST_ASSERT(offset - block_start < block_size);
-#else
-      SVN_TEST_ASSERT(block_start % 0x1000 == 0);
-      SVN_TEST_ASSERT(offset - block_start < 0x1000);
-#endif
     }
 
   /* we must be at the desired offset */

Modified: subversion/trunk/tools/server-side/fsfs-stats.c
URL: http://svn.apache.org/viewvc/subversion/trunk/tools/server-side/fsfs-stats.c?rev=1572303&r1=1572302&r2=1572303&view=diff
==============================================================================
--- subversion/trunk/tools/server-side/fsfs-stats.c (original)
+++ subversion/trunk/tools/server-side/fsfs-stats.c Wed Feb 26 22:28:50 2014
@@ -355,7 +355,6 @@ get_content(svn_stringbuf_t **content,
   *content = svn_stringbuf_create_ensure(len, pool);
   (*content)->len = len;
 
-#if APR_VERSION_AT_LEAST(1,3,0)
   /* for better efficiency use larger buffers on large reads */
   if (   (len >= large_buffer_size)
       && (apr_file_buffer_size_get(file) < large_buffer_size))
@@ -363,7 +362,6 @@ get_content(svn_stringbuf_t **content,
                         apr_palloc(apr_file_pool_get(file),
                                    large_buffer_size),
                         large_buffer_size);
-#endif
 
   SVN_ERR(svn_io_file_seek(file, APR_SET, &offset, pool));
   SVN_ERR(svn_io_file_read_full2(file, (*content)->data, len,



Mime
View raw message