You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by fu...@apache.org on 2009/09/29 14:14:46 UTC

svn commit: r819897 - /apr/apr/trunk/shmem/unix/shm.c

Author: fuankg
Date: Tue Sep 29 12:14:45 2009
New Revision: 819897

URL: http://svn.apache.org/viewvc?rev=819897&view=rev
Log:
changed conditionals to avoid a couple of 'statement not reached'
warnings with strict compilers.

Modified:
    apr/apr/trunk/shmem/unix/shm.c

Modified: apr/apr/trunk/shmem/unix/shm.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/shmem/unix/shm.c?rev=819897&r1=819896&r2=819897&view=diff
==============================================================================
--- apr/apr/trunk/shmem/unix/shm.c (original)
+++ apr/apr/trunk/shmem/unix/shm.c Tue Sep 29 12:14:45 2009
@@ -33,8 +33,7 @@
             return errno;
         }
         return APR_SUCCESS;
-#endif
-#if APR_USE_SHMEM_SHMGET_ANON
+#elif APR_USE_SHMEM_SHMGET_ANON
         if (shmdt(m->base) == -1) {
             return errno;
         }
@@ -56,8 +55,7 @@
         else {
             return apr_file_remove(m->filename, m->pool);
         }
-#endif
-#if APR_USE_SHMEM_MMAP_SHM
+#elif APR_USE_SHMEM_MMAP_SHM
         if (munmap(m->base, m->realsize) == -1) {
             return errno;
         }
@@ -65,8 +63,7 @@
             return errno;
         }
         return APR_SUCCESS;
-#endif
-#if APR_USE_SHMEM_SHMGET
+#elif APR_USE_SHMEM_SHMGET
         /* Indicate that the segment is to be destroyed as soon
          * as all processes have detached. This also disallows any
          * new attachments to the segment. */
@@ -82,10 +79,10 @@
         else {
             return apr_file_remove(m->filename, m->pool);
         }
+#else
+        return APR_ENOTIMPL;
 #endif
     }
-
-    return APR_ENOTIMPL;
 }
 
 APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m,
@@ -172,9 +169,7 @@
         return APR_SUCCESS;
 
 #endif /* APR_USE_SHMEM_MMAP_ZERO */
-#endif /* APR_USE_SHMEM_MMAP_ZERO || APR_USE_SHMEM_MMAP_ANON */
-#if APR_USE_SHMEM_SHMGET_ANON
-
+#elif APR_USE_SHMEM_SHMGET_ANON
         new_m = apr_palloc(pool, sizeof(apr_shm_t));
         new_m->pool = pool;
         new_m->reqsize = reqsize;
@@ -213,9 +208,10 @@
                                   apr_pool_cleanup_null);
         *m = new_m;
         return APR_SUCCESS;
-#endif /* APR_USE_SHMEM_SHMGET_ANON */
+#else
         /* It is an error if they want anonymous memory but we don't have it. */
         return APR_ENOTIMPL; /* requested anonymous but we don't have it */
+#endif
     }
 
     /* Name-based shared memory */
@@ -303,9 +299,7 @@
         *m = new_m;
         return APR_SUCCESS;
 
-#endif /* APR_USE_SHMEM_MMAP_TMP || APR_USE_SHMEM_MMAP_SHM */
-
-#if APR_USE_SHMEM_SHMGET
+#elif APR_USE_SHMEM_SHMGET
         new_m->realsize = reqsize;
 
         /* FIXME: APR_OS_DEFAULT is too permissive, switch to 600 I think. */
@@ -359,10 +353,10 @@
         *m = new_m; 
         return APR_SUCCESS;
 
-#endif /* APR_USE_SHMEM_SHMGET */
+#else
+        return APR_ENOTIMPL;
+#endif
     }
-
-    return APR_ENOTIMPL;
 }
 
 APR_DECLARE(apr_status_t) apr_shm_remove(const char *filename,
@@ -377,14 +371,12 @@
 
 #if APR_USE_SHMEM_MMAP_TMP
     return apr_file_remove(filename, pool);
-#endif
-#if APR_USE_SHMEM_MMAP_SHM
+#elif APR_USE_SHMEM_MMAP_SHM
     if (shm_unlink(filename) == -1) {
         return errno;
     }
     return APR_SUCCESS;
-#endif
-#if APR_USE_SHMEM_SHMGET
+#elif APR_USE_SHMEM_SHMGET
     /* Presume that the file already exists; just open for writing */    
     status = apr_file_open(&file, filename, APR_WRITE,
                            APR_OS_DEFAULT, pool);
@@ -418,10 +410,11 @@
     /* ensure the file has been removed anyway. */
     apr_file_remove(filename, pool);
     return status;
-#endif
+#else
 
     /* No support for anonymous shm */
     return APR_ENOTIMPL;
+#endif
 } 
 
 APR_DECLARE(apr_status_t) apr_shm_destroy(apr_shm_t *m)
@@ -443,16 +436,15 @@
             return errno;
         }
         return APR_SUCCESS;
-#endif /* APR_USE_SHMEM_MMAP_TMP || APR_USE_SHMEM_MMAP_SHM */
-#if APR_USE_SHMEM_SHMGET
+#elif APR_USE_SHMEM_SHMGET
         if (shmdt(m->base) == -1) {
             return errno;
         }
         return APR_SUCCESS;
+#else
+        return APR_ENOTIMPL;
 #endif
     }
-
-    return APR_ENOTIMPL;
 }
 
 APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m,
@@ -520,8 +512,7 @@
         *m = new_m;
         return APR_SUCCESS;
 
-#endif /* APR_USE_SHMEM_MMAP_TMP || APR_USE_SHMEM_MMAP_SHM */
-#if APR_USE_SHMEM_SHMGET
+#elif APR_USE_SHMEM_SHMGET
         apr_shm_t *new_m;
         apr_status_t status;
         apr_file_t *file;   /* file where metadata is stored */
@@ -566,10 +557,10 @@
         *m = new_m;
         return APR_SUCCESS;
 
-#endif /* APR_USE_SHMEM_SHMGET */
+#else
+        return APR_ENOTIMPL;
+#endif
     }
-
-    return APR_ENOTIMPL;
 }
 
 APR_DECLARE(apr_status_t) apr_shm_detach(apr_shm_t *m)