You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by yl...@apache.org on 2021/03/02 00:45:07 UTC

svn commit: r1887062 - in /apr/apr/trunk: CHANGES include/apr_mmap.h mmap/win32/mmap.c

Author: ylavic
Date: Tue Mar  2 00:45:07 2021
New Revision: 1887062

URL: http://svn.apache.org/viewvc?rev=1887062&view=rev
Log:
Remove Windows apr_mmap_t members pstart, psize and poffset.

They are only used locally in apr_mmap_create().

Modified:
    apr/apr/trunk/CHANGES
    apr/apr/trunk/include/apr_mmap.h
    apr/apr/trunk/mmap/win32/mmap.c

Modified: apr/apr/trunk/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/trunk/CHANGES?rev=1887062&r1=1887061&r2=1887062&view=diff
==============================================================================
--- apr/apr/trunk/CHANGES [utf-8] (original)
+++ apr/apr/trunk/CHANGES [utf-8] Tue Mar  2 00:45:07 2021
@@ -1,6 +1,9 @@
                                                      -*- coding: utf-8 -*-
 Changes for APR 2.0.0
 
+  *) apr_mmap_t members pstart, psize and poffset are used internally only
+     on Windows, remove them.  [Yann Yalvic]
+
   *) Align apr_mmap()ing offset to a page boundary. [Yann Ylavic]
 
   *) APR's configure script uses AC_TRY_RUN to detect whether the return type

Modified: apr/apr/trunk/include/apr_mmap.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_mmap.h?rev=1887062&r1=1887061&r2=1887062&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_mmap.h (original)
+++ apr/apr/trunk/include/apr_mmap.h Tue Mar  2 00:45:07 2021
@@ -70,10 +70,6 @@ struct apr_mmap_t {
     HANDLE mhandle;
     /** The start of the real memory page area (mapped view) */
     void *mv;
-    /** The physical start, size and offset */
-    apr_off_t  pstart;
-    apr_size_t psize;
-    apr_off_t  poffset;
 #else
     apr_off_t poffset;
 #endif

Modified: apr/apr/trunk/mmap/win32/mmap.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/mmap/win32/mmap.c?rev=1887062&r1=1887061&r2=1887062&view=diff
==============================================================================
--- apr/apr/trunk/mmap/win32/mmap.c (original)
+++ apr/apr/trunk/mmap/win32/mmap.c Tue Mar  2 00:45:07 2021
@@ -72,8 +72,11 @@ APR_DECLARE(apr_status_t) apr_mmap_creat
     static DWORD memblock = 0;
     DWORD fmaccess = 0;
     DWORD mvaccess = 0;
-    DWORD offlo;
-    DWORD offhi;
+    /** The physical start, size and offset */
+    apr_off_t  pstart;
+    apr_size_t psize;
+    apr_off_t  poffset;
+    DWORD offlo, offhi;
 
     if (size == 0)
         return APR_EINVAL;
@@ -100,9 +103,9 @@ APR_DECLARE(apr_status_t) apr_mmap_creat
     }   
     
     *new = apr_pcalloc(cont, sizeof(apr_mmap_t));
-    (*new)->pstart = (offset / memblock) * memblock;
-    (*new)->poffset = offset - (*new)->pstart;
-    (*new)->psize = (apr_size_t)((*new)->poffset) + size;
+    pstart = (offset / memblock) * memblock;
+    poffset = offset - pstart;
+    psize = (apr_size_t)poffset + size;
     /* The size of the CreateFileMapping object is the current size
      * of the size of the mmap object (e.g. file size), not the size 
      * of the mapped region!
@@ -128,10 +131,10 @@ APR_DECLARE(apr_status_t) apr_mmap_creat
         return apr_get_os_error();
     }
 
-    offlo = (DWORD)(*new)->pstart;
-    offhi = (DWORD)((*new)->pstart >> 32);
+    offlo = (DWORD)pstart;
+    offhi = (DWORD)(pstart >> 32);
     (*new)->mv = MapViewOfFile((*new)->mhandle, mvaccess, offhi,
-                               offlo, (*new)->psize);
+                               offlo, psize);
     if (!(*new)->mv)
     {
         apr_status_t rv = apr_get_os_error();
@@ -140,7 +143,7 @@ APR_DECLARE(apr_status_t) apr_mmap_creat
         return rv;
     }
 
-    (*new)->mm = (char*)((*new)->mv) + (*new)->poffset;
+    (*new)->mm = (char *)(*new)->mv + poffset;
     (*new)->size = size;
     (*new)->cntxt = cont;
     APR_RING_ELEM_INIT(*new, link);