Last for today (compiles clean on Win32, hope the same for the rest of
  our builds.)  Clean up inherit_[un]set and simplify win32 discrepancy
  with inherit.h


git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@63481 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/file_io/os2/open.c b/file_io/os2/open.c
index cef62e5..05301d8 100644
--- a/file_io/os2/open.c
+++ b/file_io/os2/open.c
@@ -267,7 +267,7 @@
 
 APR_POOL_IMPLEMENT_ACCESSOR(file);
 
-APR_IMPLEMENT_SET_INHERIT(file, flags, pool, apr_file_cleanup)
+APR_IMPLEMENT_INHERIT_SET(file, flags, pool, apr_file_cleanup)
 
-APR_IMPLEMENT_UNSET_INHERIT(file, flags, pool, apr_file_cleanup)
+APR_IMPLEMENT_INHERIT_UNSET(file, flags, pool, apr_file_cleanup)
 
diff --git a/file_io/unix/filedup.c b/file_io/unix/filedup.c
index 8c43de8..67b5e49 100644
--- a/file_io/unix/filedup.c
+++ b/file_io/unix/filedup.c
@@ -113,7 +113,7 @@
     (*new_file)->ungetchar = old_file->ungetchar;
 
     /* apr_file_dup() clears the inherit attribute, user must call 
-     * apr_file_set_inherit() again on the dupped handle, as necessary.
+     * apr_file_inherit_set() again on the dupped handle, as necessary.
      */
     (*new_file)->flags = old_file->flags & ~APR_INHERIT;
 
diff --git a/file_io/unix/open.c b/file_io/unix/open.c
index f887c9a..46882a1 100644
--- a/file_io/unix/open.c
+++ b/file_io/unix/open.c
@@ -272,8 +272,8 @@
     return apr_os_file_put(thefile, &fd, 0, pool);
 }
 
-APR_IMPLEMENT_SET_INHERIT(file, flags, pool, apr_unix_file_cleanup)
+APR_IMPLEMENT_INHERIT_SET(file, flags, pool, apr_unix_file_cleanup)
 
-APR_IMPLEMENT_UNSET_INHERIT(file, flags, pool, apr_unix_file_cleanup)
+APR_IMPLEMENT_INHERIT_UNSET(file, flags, pool, apr_unix_file_cleanup)
 
 APR_POOL_IMPLEMENT_ACCESSOR(file)
diff --git a/file_io/win32/open.c b/file_io/win32/open.c
index df7a959..796d0e4 100644
--- a/file_io/win32/open.c
+++ b/file_io/win32/open.c
@@ -68,6 +68,7 @@
 #include <sys/stat.h>
 #endif
 #include "misc.h"
+#include "inherit.h"
 
 #if APR_HAS_UNICODE_FS
 apr_status_t utf8_to_unicode_path(apr_wchar_t* retstr, apr_size_t retlen, 
@@ -605,10 +606,6 @@
 
 APR_POOL_IMPLEMENT_ACCESSOR(file);
 
-APR_DECLARE_SET_INHERIT(file) {
-    return;
-}
-
-APR_DECLARE_UNSET_INHERIT(file) {
-    return;
-}
+APR_IMPLEMENT_INHERIT_SET(file, flags, pool, file_cleanup)
+ 
+APR_IMPLEMENT_INHERIT_UNSET(file, flags, pool, file_cleanup)
diff --git a/include/apr_file_io.h b/include/apr_file_io.h
index f6af7d1..b1775b4 100644
--- a/include/apr_file_io.h
+++ b/include/apr_file_io.h
@@ -118,11 +118,11 @@
 /** @} */
 
 /**
- * @defgroup APR_file_set_attributes File Attribute Flags
+ * @defgroup APR_file_attrs_set File Attribute Flags
  * @{
  */
 
-/* flags for apr_file_set_attributes */
+/* flags for apr_file_attrs_set */
 #define APR_FILE_ATTR_READONLY   0x01          /**< File is read-only */
 #define APR_FILE_ATTR_EXECUTABLE 0x02          /**< File is executable */
 /** @} */
@@ -666,12 +666,18 @@
  * @param file The file to enable inheritance.
  *
  */
-APR_DECLARE(void) apr_file_set_inherit(apr_file_t *file);
+APR_DECLARE(void) apr_file_inherit_set(apr_file_t *file);
 
 /**
  * Unset a file from being inherited by child processes.
  * @param file The file to disable inheritance.
  */
+APR_DECLARE(void) apr_file_inherit_unset(apr_file_t *file);
+
+/** @deprecated @see apr_file_inherit_set */
+APR_DECLARE(void) apr_file_set_inherit(apr_file_t *file);
+
+/** @deprecated @see apr_file_inherit_unset */
 APR_DECLARE(void) apr_file_unset_inherit(apr_file_t *file);
 
 /**
diff --git a/include/apr_inherit.h b/include/apr_inherit.h
index 07b1d21..d917b61 100644
--- a/include/apr_inherit.h
+++ b/include/apr_inherit.h
@@ -70,17 +70,18 @@
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
+
 /**
  * @param name Set Inheritance for this Socket/File Handle
  */
-#define APR_DECLARE_SET_INHERIT(name) \
-    APR_DECLARE(void) apr_##name##_set_inherit(apr_##name##_t *name)
+#define APR_DECLARE_INHERIT_SET(name) \
+    APR_DECLARE(void) apr_##name##_inherit_set(apr_##name##_t *name)
+
 /**
  * @param name Unset Inheritance for this Socket/File Handle
  */
-
-#define APR_DECLARE_UNSET_INHERIT(name) \
-    APR_DECLARE(void) apr_##name##_unset_inherit(apr_##name##_t *name)
+#define APR_DECLARE_INHERIT_UNSET(name) \
+    APR_DECLARE(void) apr_##name##_inherit_unset(apr_##name##_t *name)
 
 #ifdef __cplusplus
 }
diff --git a/include/apr_network_io.h b/include/apr_network_io.h
index 44e3792..723c6ac 100644
--- a/include/apr_network_io.h
+++ b/include/apr_network_io.h
@@ -811,13 +811,19 @@
  * Set a socket to be inherited by child processes.
  * @param socket The socket to enable inheritance.
  */
+APR_DECLARE(void) apr_socket_inherit_set(apr_socket_t *skt);
+
+/** @deprecated @see apr_socket_inherit_set */
 APR_DECLARE(void) apr_socket_set_inherit(apr_socket_t *skt);
 
 /**
  * Unset a socket from being inherited by child processes.
  * @param socket The socket to disable inheritance.
  */
-APR_DECLARE(void) apr_socket_unset_inherit(apr_socket_t *skt);
+APR_DECLARE(void) apr_socket_inherit_unset(apr_socket_t *skt);
+
+/** @deprecated @see apr_socket_inherit_set */
+APR_DECLARE(void) apr_socket_set_inherit(apr_socket_t *skt);
 
 #ifdef __cplusplus
 }
diff --git a/include/arch/unix/inherit.h b/include/arch/unix/inherit.h
index 503daf6..0908352 100644
--- a/include/arch/unix/inherit.h
+++ b/include/arch/unix/inherit.h
@@ -59,24 +59,34 @@
 
 #define APR_INHERIT    (2^24)    /* Must not conflicts with other bits */
 
-#define APR_IMPLEMENT_SET_INHERIT(name, flag, pool, cleanup)        \
-void apr_##name##_set_inherit(apr_##name##_t *name)                 \
+#define APR_IMPLEMENT_INHERIT_SET(name, flag, pool, cleanup)        \
+void apr_##name##_inherit_set(apr_##name##_t *name)                 \
 {                                                                   \
     if (!(name->flag & APR_INHERIT)) {                              \
         name->flag |= APR_INHERIT;                                  \
         apr_pool_child_cleanup_set(name->pool, (void *)name,        \
                                    cleanup, apr_pool_cleanup_null); \
     }                                                               \
+}                                                                   \
+/* Deprecated */                                                    \
+void apr_##name##_set_inherit(apr_##name##_t *name)                 \
+{                                                                   \
+    apr_##name##_inherit_set(name);                                 \
 }
 
-#define APR_IMPLEMENT_UNSET_INHERIT(name, flag, pool, cleanup)      \
-void apr_##name##_unset_inherit(apr_##name##_t *name)               \
+#define APR_IMPLEMENT_INHERIT_UNSET(name, flag, pool, cleanup)      \
+void apr_##name##_inherit_unset(apr_##name##_t *name)               \
 {                                                                   \
     if (name->flag & APR_INHERIT) {                                 \
         name->flag &= ~APR_INHERIT;                                 \
         apr_pool_child_cleanup_set(name->pool, (void *)name,        \
                                    cleanup, cleanup);               \
     }                                                               \
+}                                                                   \
+/* Deprecated */                                                    \
+void apr_##name##_unset_inherit(apr_##name##_t *name)               \
+{                                                                   \
+    apr_##name##_inherit_unset(name);                               \
 }
 
 #endif	/* ! INHERIT_H */
diff --git a/include/arch/win32/inherit.h b/include/arch/win32/inherit.h
index 7bc46a0..577b978 100644
--- a/include/arch/win32/inherit.h
+++ b/include/arch/win32/inherit.h
@@ -60,33 +60,25 @@
 #define APR_INHERIT    (2^24)    /* Must not conflicts with other bits */
 
 #define APR_IMPLEMENT_INHERIT_SET(name, flag, pool, cleanup)        \
-void apr_##name##_inherit_set(apr_##name##_t *name)                 \
+APR_DECLARE(void) apr_##name##_inherit_set(apr_##name##_t *name)    \
 {                                                                   \
-    if (!(name->flag & APR_INHERIT)) {                              \
-        name->flag |= APR_INHERIT;                                  \
-        apr_pool_child_cleanup_set(name->pool, (void *)name,        \
-                                   cleanup, apr_pool_cleanup_null); \
-    }                                                               \
+    return;                                                         \
 }                                                                   \
 /* Deprecated */                                                    \
-void apr_##name##_set_inherit(apr_##name##_t *name)                 \
+APR_DECLARE(void) apr_##name##_set_inherit(apr_##name##_t *name)    \
 {                                                                   \
-    apr_##name##_inherit_set(apr_##name##_t *name)                  \
+    apr_##name##_inherit_set(name);                                 \
 }
 
 #define APR_IMPLEMENT_INHERIT_UNSET(name, flag, pool, cleanup)      \
-void apr_##name##_inherit_unset(apr_##name##_t *name)               \
+APR_DECLARE(void) apr_##name##_inherit_unset(apr_##name##_t *name)  \
 {                                                                   \
-    if (name->flag & APR_INHERIT) {                                 \
-        name->flag &= ~APR_INHERIT;                                 \
-        apr_pool_child_cleanup_set(name->pool, (void *)name,        \
-                                   cleanup, cleanup);               \
-    }                                                               \
+    return;                                                         \
 }                                                                   \
 /* Deprecated */                                                    \
-void apr_##name##_unset_inherit(apr_##name##_t *name)               \
+APR_DECLARE(void) apr_##name##_unset_inherit(apr_##name##_t *name)  \
 {                                                                   \
-    apr_##name##_inherit_unset(apr_##name##_t *name)                \
+    apr_##name##_inherit_unset(name);                               \
 }
 
 #endif	/* ! INHERIT_H */
diff --git a/network_io/os2/sockets.c b/network_io/os2/sockets.c
index c810994..0c2d5ba 100644
--- a/network_io/os2/sockets.c
+++ b/network_io/os2/sockets.c
@@ -296,6 +296,6 @@
     return APR_SUCCESS;
 }
 
-APR_IMPLEMENT_SET_INHERIT(socket, inherit, cntxt, socket_cleanup)
+APR_IMPLEMENT_INHERIT_SET(socket, inherit, cntxt, socket_cleanup)
 
-APR_IMPLEMENT_UNSET_INHERIT(socket, inherit, cntxt, socket_cleanup)
+APR_IMPLEMENT_INHERIT_UNSET(socket, inherit, cntxt, socket_cleanup)
diff --git a/network_io/unix/sockets.c b/network_io/unix/sockets.c
index 38426be..58f7fd2 100644
--- a/network_io/unix/sockets.c
+++ b/network_io/unix/sockets.c
@@ -371,6 +371,6 @@
     return APR_SUCCESS;
 }
 
-APR_IMPLEMENT_SET_INHERIT(socket, inherit, cntxt, socket_cleanup)
+APR_IMPLEMENT_INHERIT_SET(socket, inherit, cntxt, socket_cleanup)
 
-APR_IMPLEMENT_UNSET_INHERIT(socket, inherit, cntxt, socket_cleanup)
+APR_IMPLEMENT_INHERIT_UNSET(socket, inherit, cntxt, socket_cleanup)
diff --git a/network_io/win32/sockets.c b/network_io/win32/sockets.c
index aa29168..32817f2 100644
--- a/network_io/win32/sockets.c
+++ b/network_io/win32/sockets.c
@@ -58,6 +58,7 @@
 #include "apr_lib.h"
 #include "apr_portable.h"
 #include <string.h>
+#include "inherit.h"
 
 static char generic_inaddr_any[16] = {0}; /* big enough for IPv4 or IPv6 */
 
@@ -423,10 +424,6 @@
     return APR_SUCCESS;
 }
 
-APR_DECLARE_SET_INHERIT(socket) {
-    return;
-}
+APR_IMPLEMENT_INHERIT_SET(socket, inherit, cntxt, socket_cleanup)
 
-APR_DECLARE_UNSET_INHERIT(socket) {
-    return;
-}
+APR_IMPLEMENT_INHERIT_UNSET(socket, inherit, cntxt, socket_cleanup)