guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Remove unneeded HAVE_POSIX conditionals


From: Eli Zaretskii
Subject: [PATCH] Remove unneeded HAVE_POSIX conditionals
Date: Sat, 22 Feb 2014 12:33:33 +0200

This patch removes several "#ifdef HAVE_POSIX" conditionals that
unnecessarily prevent useful Guile functions from showing up in the
MinGW build on MS-Windows.

Remove unneeded HAVE_POSIX conditionals

* libguile/filesys.c (fsync, link) [__MINGW32__]: Redirect Posix
  functions to their Windows equivalents.
  (scm_chown, scm_open_fdes, scm_open, scm_close, scm_close_fdes)
  (scm_link, scm_chdir, set_element, fill_select_type)
  (get_element, retrieve_select_type, scm_select, scm_fcntl)
  (scm_fsync, scm_symlink, scm_readlink, scm_copy_file, scm_sendfile)
  (scm_dir_print, scm_dir_free): These functions are no longer
  wholesale ifdef'ed away if HAVE_POSIX is not defined.
  (scm_init_filesys): Don't ifdef away parts of the function when
  HAVE_POSIX is not defined.

diff --git a/libguile/filesys.c b/libguile/filesys.c
index aa3e671..441ced8 100644
--- a/libguile/filesys.c
+++ b/libguile/filesys.c
@@ -111,7 +111,12 @@
 
 /* Some more definitions for the native Windows port. */
 #ifdef __MINGW32__
-# define fsync(fd) _commit (fd)
+# define fsync(fd)    _commit (fd)
+# define WIN32_LEAN_AND_MEAN
+# include <windows.h>
+/* FIXME: Should use 'link' module from gnulib.  */
+# define link(f1,f2)  CreateHardLink(f2, f1, NULL)
+# define HAVE_LINK 1
 #endif /* __MINGW32__ */
 
 
@@ -146,8 +151,6 @@
 
 
 
-#ifdef HAVE_POSIX
-
 /* {Permissions}
  */
 
@@ -323,8 +326,6 @@ SCM_DEFINE (scm_close_fdes, "close-fdes", 1, 0, 0,
 }
 #undef FUNC_NAME
 
-#endif /* HAVE_POSIX */
-
 
 /* {Files}
  */
@@ -590,7 +591,6 @@ SCM_DEFINE (scm_lstat, "lstat", 1, 0, 0,
 #endif /* HAVE_LSTAT */
 
 
-#ifdef HAVE_POSIX
 
 /* {Modifying Directories}
  */
@@ -1222,8 +1222,6 @@ SCM_DEFINE (scm_sendfile, "sendfile", 3, 1, 0,
 }
 #undef FUNC_NAME
 
-#endif /* HAVE_POSIX */
-
 
 /* Essential procedures used in (system base compile).  */
 
@@ -1848,7 +1846,6 @@ SCM_DEFINE (scm_closedir, "closedir", 1, 0, 0,
 #undef FUNC_NAME
 
 
-#ifdef HAVE_POSIX
 static int
 scm_dir_print (SCM exp, SCM port, scm_print_state *pstate SCM_UNUSED)
 {
@@ -1869,14 +1866,12 @@ scm_dir_free (SCM p)
     closedir ((DIR *) SCM_SMOB_DATA_1 (p));
   return 0;
 }
-#endif
 
 
 
 void
 scm_init_filesys ()
 {
-#ifdef HAVE_POSIX
   scm_tc16_dir = scm_make_smob_type ("directory", 0);
   scm_set_smob_free (scm_tc16_dir, scm_dir_free);
   scm_set_smob_print (scm_tc16_dir, scm_dir_print);
@@ -1945,7 +1940,6 @@ scm_init_filesys ()
 #ifdef FD_CLOEXEC  
   scm_c_define ("FD_CLOEXEC", scm_from_int (FD_CLOEXEC));
 #endif
-#endif /* HAVE_POSIX */
 
   /* `access' symbols.  */
   scm_c_define ("R_OK", scm_from_int (R_OK));



reply via email to

[Prev in Thread] Current Thread [Next in Thread]