apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r190305 - in /apr/apr/trunk: include/ include/arch/os2/ include/arch/unix/ include/arch/win32/ network_io/os2/ network_io/unix/ network_io/win32/
Date Sun, 12 Jun 2005 17:54:26 GMT
Author: mturk
Date: Sun Jun 12 10:54:25 2005
New Revision: 190305

URL: http://svn.apache.org/viewcvs?rev=190305&view=rev
Log:
Implement pool accessor for sockets
There is no functional change except changing stuct
mamber from cntxt to pool to be able to use the
ACCESSOR macros.

Modified:
    apr/apr/trunk/include/apr_network_io.h
    apr/apr/trunk/include/arch/os2/apr_arch_networkio.h
    apr/apr/trunk/include/arch/unix/apr_arch_networkio.h
    apr/apr/trunk/include/arch/win32/apr_arch_networkio.h
    apr/apr/trunk/network_io/os2/sockets.c
    apr/apr/trunk/network_io/unix/sendrecv.c
    apr/apr/trunk/network_io/unix/sockets.c
    apr/apr/trunk/network_io/win32/sendrecv.c
    apr/apr/trunk/network_io/win32/sockets.c

Modified: apr/apr/trunk/include/apr_network_io.h
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/include/apr_network_io.h?rev=190305&r1=190304&r2=190305&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_network_io.h (original)
+++ apr/apr/trunk/include/apr_network_io.h Sun Jun 12 10:54:25 2005
@@ -739,6 +739,11 @@
                                                   int *protocol);
 
 /**
+ * Get the pool used by the socket.
+ */
+APR_POOL_DECLARE_ACCESSOR(socket);
+
+/**
  * Set a socket to be inherited by child processes.
  */
 APR_DECLARE_INHERIT_SET(socket);

Modified: apr/apr/trunk/include/arch/os2/apr_arch_networkio.h
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/include/arch/os2/apr_arch_networkio.h?rev=190305&r1=190304&r2=190305&view=diff
==============================================================================
--- apr/apr/trunk/include/arch/os2/apr_arch_networkio.h (original)
+++ apr/apr/trunk/include/arch/os2/apr_arch_networkio.h Sun Jun 12 10:54:25 2005
@@ -35,7 +35,7 @@
 };
 
 struct apr_socket_t {
-    apr_pool_t *cntxt;
+    apr_pool_t *pool;
     int socketdes;
     int type;
     int protocol;

Modified: apr/apr/trunk/include/arch/unix/apr_arch_networkio.h
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/include/arch/unix/apr_arch_networkio.h?rev=190305&r1=190304&r2=190305&view=diff
==============================================================================
--- apr/apr/trunk/include/arch/unix/apr_arch_networkio.h (original)
+++ apr/apr/trunk/include/arch/unix/apr_arch_networkio.h Sun Jun 12 10:54:25 2005
@@ -101,7 +101,7 @@
 };
 
 struct apr_socket_t {
-    apr_pool_t *cntxt;
+    apr_pool_t *pool;
     int socketdes;
     int type;
     int protocol;

Modified: apr/apr/trunk/include/arch/win32/apr_arch_networkio.h
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/include/arch/win32/apr_arch_networkio.h?rev=190305&r1=190304&r2=190305&view=diff
==============================================================================
--- apr/apr/trunk/include/arch/win32/apr_arch_networkio.h (original)
+++ apr/apr/trunk/include/arch/win32/apr_arch_networkio.h Sun Jun 12 10:54:25 2005
@@ -29,7 +29,7 @@
 };
 
 struct apr_socket_t {
-    apr_pool_t         *cntxt;
+    apr_pool_t         *pool;
     SOCKET              socketdes;
     int                 type; /* SOCK_STREAM, SOCK_DGRAM */
     int                 protocol;

Modified: apr/apr/trunk/network_io/os2/sockets.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/network_io/os2/sockets.c?rev=190305&r1=190304&r2=190305&view=diff
==============================================================================
--- apr/apr/trunk/network_io/os2/sockets.c (original)
+++ apr/apr/trunk/network_io/os2/sockets.c Sun Jun 12 10:54:25 2005
@@ -58,11 +58,11 @@
 static void alloc_socket(apr_socket_t **new, apr_pool_t *p)
 {
     *new = (apr_socket_t *)apr_pcalloc(p, sizeof(apr_socket_t));
-    (*new)->cntxt = p;
-    (*new)->local_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->cntxt,
+    (*new)->pool = p;
+    (*new)->local_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->pool,
                                                        sizeof(apr_sockaddr_t));
     (*new)->local_addr->pool = p;
-    (*new)->remote_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->cntxt,
+    (*new)->remote_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->pool,
                                                         sizeof(apr_sockaddr_t));
     (*new)->remote_addr->pool = p;
 
@@ -108,7 +108,7 @@
 
     (*new)->timeout = -1;
     (*new)->nonblock = FALSE;
-    apr_pool_cleanup_register((*new)->cntxt, (void *)(*new), 
+    apr_pool_cleanup_register((*new)->pool, (void *)(*new), 
                         socket_cleanup, apr_pool_cleanup_null);
 
     return APR_SUCCESS;
@@ -127,7 +127,7 @@
 
 APR_DECLARE(apr_status_t) apr_socket_close(apr_socket_t *thesocket)
 {
-    apr_pool_cleanup_kill(thesocket->cntxt, thesocket, socket_cleanup);
+    apr_pool_cleanup_kill(thesocket->pool, thesocket, socket_cleanup);
     return socket_cleanup(thesocket);
 }
 
@@ -180,7 +180,7 @@
         (*new)->local_addr->ipaddr_ptr = &(*new)->local_addr->sa.sin.sin_addr;
     }
 
-    apr_pool_cleanup_register((*new)->cntxt, (void *)(*new), 
+    apr_pool_cleanup_register((*new)->pool, (void *)(*new), 
                         socket_cleanup, apr_pool_cleanup_null);
     return APR_SUCCESS;
 }
@@ -231,15 +231,15 @@
 APR_DECLARE(apr_status_t) apr_socket_data_set(apr_socket_t *sock, void *data, const char
*key,
                                      apr_status_t (*cleanup) (void *))
 {
-    sock_userdata_t *new = apr_palloc(sock->cntxt, sizeof(sock_userdata_t));
+    sock_userdata_t *new = apr_palloc(sock->pool, sizeof(sock_userdata_t));
 
-    new->key = apr_pstrdup(sock->cntxt, key);
+    new->key = apr_pstrdup(sock->pool, key);
     new->data = data;
     new->next = sock->userdata;
     sock->userdata = new;
 
     if (cleanup) {
-        apr_pool_cleanup_register(sock->cntxt, data, cleanup, cleanup);
+        apr_pool_cleanup_register(sock->pool, data, cleanup, cleanup);
     }
 
     return APR_SUCCESS;
@@ -280,7 +280,7 @@
         (*apr_sock)->remote_addr_unknown = 1;
     }
         
-    apr_pool_cleanup_register((*apr_sock)->cntxt, (void *)(*apr_sock), 
+    apr_pool_cleanup_register((*apr_sock)->pool, (void *)(*apr_sock), 
                         socket_cleanup, apr_pool_cleanup_null);
 
     return APR_SUCCESS;
@@ -302,6 +302,8 @@
     (*sock)->socketdes = *thesock;
     return APR_SUCCESS;
 }
+
+APR_POOL_IMPLEMENT_ACCESSOR(socket);
 
 APR_IMPLEMENT_INHERIT_SET(socket, inherit, cntxt, socket_cleanup)
 

Modified: apr/apr/trunk/network_io/unix/sendrecv.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/network_io/unix/sendrecv.c?rev=190305&r1=190304&r2=190305&view=diff
==============================================================================
--- apr/apr/trunk/network_io/unix/sendrecv.c (original)
+++ apr/apr/trunk/network_io/unix/sendrecv.c Sun Jun 12 10:54:25 2005
@@ -578,7 +578,7 @@
         }  
 
         /* XXX:  BUHHH? wow, what a memory leak! */
-        headerbuf = hdtrarray[0].iov_base = apr_palloc(sock->cntxt, headerlen);
+        headerbuf = hdtrarray[0].iov_base = apr_palloc(sock->pool, headerlen);
         hdtrarray[0].iov_len = headerlen;
 
         for (i = 0; i < hdtr->numheaders; i++) {
@@ -603,7 +603,7 @@
         }
 
         /* XXX:  BUHHH? wow, what a memory leak! */
-        trailerbuf = hdtrarray[1].iov_base = apr_palloc(sock->cntxt, trailerlen);
+        trailerbuf = hdtrarray[1].iov_base = apr_palloc(sock->pool, trailerlen);
         hdtrarray[1].iov_len = trailerlen;
 
         for (i = 0; i < hdtr->numtrailers; i++) {
@@ -714,7 +714,7 @@
             /* but headers are small, so maybe we can hold on to the
              * memory for the life of the socket...
              */
-            hbuf = apr_palloc(sock->cntxt, parms.header_length);
+            hbuf = apr_palloc(sock->pool, parms.header_length);
 #endif
             ptr = 0;
             for (i = 0; i < hdtr->numheaders; i++) {
@@ -740,7 +740,7 @@
             /* Keepalives make apr_palloc a bad idea */
             tbuf = malloc(parms.trailer_length);
 #else
-            tbuf = apr_palloc(sock->cntxt, parms.trailer_length);
+            tbuf = apr_palloc(sock->pool, parms.trailer_length);
 #endif
             ptr = 0;
             for (i = 0; i < hdtr->numtrailers; i++) {
@@ -853,7 +853,7 @@
 
     /* Calculate how much space we need. */
     vecs = hdtr->numheaders + hdtr->numtrailers + 1;
-    sfv = apr_palloc(sock->cntxt, sizeof(sendfilevec_t) * vecs);
+    sfv = apr_palloc(sock->pool, sizeof(sendfilevec_t) * vecs);
 
     curvec = 0;
 

Modified: apr/apr/trunk/network_io/unix/sockets.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/network_io/unix/sockets.c?rev=190305&r1=190304&r2=190305&view=diff
==============================================================================
--- apr/apr/trunk/network_io/unix/sockets.c (original)
+++ apr/apr/trunk/network_io/unix/sockets.c Sun Jun 12 10:54:25 2005
@@ -59,11 +59,11 @@
 static void alloc_socket(apr_socket_t **new, apr_pool_t *p)
 {
     *new = (apr_socket_t *)apr_pcalloc(p, sizeof(apr_socket_t));
-    (*new)->cntxt = p;
-    (*new)->local_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->cntxt,
+    (*new)->pool = p;
+    (*new)->local_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->pool,
                                                        sizeof(apr_sockaddr_t));
     (*new)->local_addr->pool = p;
-    (*new)->remote_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->cntxt,
+    (*new)->remote_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->pool,
                                                         sizeof(apr_sockaddr_t));
     (*new)->remote_addr->pool = p;
 #ifndef WAITIO_USES_POLL
@@ -131,7 +131,7 @@
 
     (*new)->timeout = -1;
     (*new)->inherit = 0;
-    apr_pool_cleanup_register((*new)->cntxt, (void *)(*new), socket_cleanup,
+    apr_pool_cleanup_register((*new)->pool, (void *)(*new), socket_cleanup,
                               socket_cleanup);
 
     return APR_SUCCESS;
@@ -145,7 +145,7 @@
 
 apr_status_t apr_socket_close(apr_socket_t *thesocket)
 {
-    return apr_pool_cleanup_run(thesocket->cntxt, thesocket, socket_cleanup);
+    return apr_pool_cleanup_run(thesocket->pool, thesocket, socket_cleanup);
 }
 
 apr_status_t apr_socket_bind(apr_socket_t *sock, apr_sockaddr_t *sa)
@@ -245,7 +245,7 @@
     }
 
     (*new)->inherit = 0;
-    apr_pool_cleanup_register((*new)->cntxt, (void *)(*new), socket_cleanup,
+    apr_pool_cleanup_register((*new)->pool, (void *)(*new), socket_cleanup,
                               socket_cleanup);
     return APR_SUCCESS;
 }
@@ -334,15 +334,15 @@
 apr_status_t apr_socket_data_set(apr_socket_t *sock, void *data, const char *key,
                                  apr_status_t (*cleanup) (void *))
 {
-    sock_userdata_t *new = apr_palloc(sock->cntxt, sizeof(sock_userdata_t));
+    sock_userdata_t *new = apr_palloc(sock->pool, sizeof(sock_userdata_t));
 
-    new->key = apr_pstrdup(sock->cntxt, key);
+    new->key = apr_pstrdup(sock->pool, key);
     new->data = data;
     new->next = sock->userdata;
     sock->userdata = new;
 
     if (cleanup) {
-        apr_pool_cleanup_register(sock->cntxt, data, cleanup, cleanup);
+        apr_pool_cleanup_register(sock->pool, data, cleanup, cleanup);
     }
 
     return APR_SUCCESS;
@@ -387,7 +387,7 @@
     }
         
     (*apr_sock)->inherit = 0;
-    apr_pool_cleanup_register((*apr_sock)->cntxt, (void *)(*apr_sock), 
+    apr_pool_cleanup_register((*apr_sock)->pool, (void *)(*apr_sock), 
                               socket_cleanup, socket_cleanup);
     return APR_SUCCESS;
 }
@@ -410,6 +410,4 @@
     return APR_SUCCESS;
 }
 
-APR_IMPLEMENT_INHERIT_SET(socket, inherit, cntxt, socket_cleanup)
-
-APR_IMPLEMENT_INHERIT_UNSET(socket, inherit, cntxt, socket_cleanup)
+APR_POOL_IMPLEMENT_ACCESSOR(socket);

Modified: apr/apr/trunk/network_io/win32/sendrecv.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/network_io/win32/sendrecv.c?rev=190305&r1=190304&r2=190305&view=diff
==============================================================================
--- apr/apr/trunk/network_io/win32/sendrecv.c (original)
+++ apr/apr/trunk/network_io/win32/sendrecv.c Sun Jun 12 10:54:25 2005
@@ -318,7 +318,7 @@
     /* Initialize the overlapped structure used on TransmitFile
      */
     if (!sock->overlapped) {
-        sock->overlapped = apr_pcalloc(sock->cntxt, sizeof(OVERLAPPED));
+        sock->overlapped = apr_pcalloc(sock->pool, sizeof(OVERLAPPED));
         sock->overlapped->hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
     }
     while (bytes_to_send) {

Modified: apr/apr/trunk/network_io/win32/sockets.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/network_io/win32/sockets.c?rev=190305&r1=190304&r2=190305&view=diff
==============================================================================
--- apr/apr/trunk/network_io/win32/sockets.c (original)
+++ apr/apr/trunk/network_io/win32/sockets.c Sun Jun 12 10:54:25 2005
@@ -55,11 +55,11 @@
 static void alloc_socket(apr_socket_t **new, apr_pool_t *p)
 {
     *new = (apr_socket_t *)apr_pcalloc(p, sizeof(apr_socket_t));
-    (*new)->cntxt = p;
-    (*new)->local_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->cntxt,
+    (*new)->pool = p;
+    (*new)->local_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->pool,
                                                        sizeof(apr_sockaddr_t));
     (*new)->local_addr->pool = p;
-    (*new)->remote_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->cntxt,
+    (*new)->remote_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->pool,
                                                         sizeof(apr_sockaddr_t));
     (*new)->remote_addr->pool = p;
 
@@ -146,7 +146,7 @@
     (*new)->timeout = -1;
     (*new)->disconnected = 0;
 
-    apr_pool_cleanup_register((*new)->cntxt, (void *)(*new), 
+    apr_pool_cleanup_register((*new)->pool, (void *)(*new), 
                         socket_cleanup, apr_pool_cleanup_null);
 
     return APR_SUCCESS;
@@ -185,7 +185,7 @@
 
 APR_DECLARE(apr_status_t) apr_socket_close(apr_socket_t *thesocket)
 {
-    apr_pool_cleanup_kill(thesocket->cntxt, thesocket, socket_cleanup);
+    apr_pool_cleanup_kill(thesocket->pool, thesocket, socket_cleanup);
     return socket_cleanup(thesocket);
 }
 
@@ -291,7 +291,7 @@
         (*new)->local_interface_unknown = 1;
     }
 
-    apr_pool_cleanup_register((*new)->cntxt, (void *)(*new), 
+    apr_pool_cleanup_register((*new)->pool, (void *)(*new), 
                         socket_cleanup, apr_pool_cleanup_null);
     return APR_SUCCESS;
 }
@@ -401,15 +401,15 @@
                                              const char *key,
                                              apr_status_t (*cleanup)(void *))
 {
-    sock_userdata_t *new = apr_palloc(sock->cntxt, sizeof(sock_userdata_t));
+    sock_userdata_t *new = apr_palloc(sock->pool, sizeof(sock_userdata_t));
 
-    new->key = apr_pstrdup(sock->cntxt, key);
+    new->key = apr_pstrdup(sock->pool, key);
     new->data = data;
     new->next = sock->userdata;
     sock->userdata = new;
 
     if (cleanup) {
-        apr_pool_cleanup_register(sock->cntxt, data, cleanup, cleanup);
+        apr_pool_cleanup_register(sock->pool, data, cleanup, cleanup);
     }
 
     return APR_SUCCESS;
@@ -454,7 +454,7 @@
         (*apr_sock)->remote_addr_unknown = 1;
     }
         
-    apr_pool_cleanup_register((*apr_sock)->cntxt, (void *)(*apr_sock), 
+    apr_pool_cleanup_register((*apr_sock)->pool, (void *)(*apr_sock), 
                         socket_cleanup, apr_pool_cleanup_null);
 
     return APR_SUCCESS;
@@ -494,4 +494,4 @@
     return APR_ENOTIMPL;
 }    
 
-
+APR_POOL_IMPLEMENT_ACCESSOR(socket);



Mime
View raw message