Build mono runtime under none desktop Windows API family, adjustments and cleanup.
[mono.git] / mono / utils / mono-io-portability.c
index 5a48418e4f32ddac7375029f5e3a46faa8c96e3e..7e22eafa8cc9cf25b2c9870a6ad44c42e5e3df0b 100644 (file)
@@ -6,34 +6,14 @@
 #endif
 #include <errno.h>
 #include <mono/utils/mono-io-portability.h>
-#include <mono/metadata/metadata.h>
-#include <mono/metadata/class.h>
-#include <mono/metadata/class-internals.h>
-#include <mono/metadata/object.h>
-#include <mono/metadata/gc-internal.h>
-#include <mono/metadata/profiler.h>
 #include <mono/metadata/profiler-private.h>
+#include <mono/utils/mono-compiler.h>
 
-#ifdef DISABLE_PORTABILITY
-int __mono_io_portability_helpers = PORTABILITY_NONE;
-
-void 
-mono_portability_helpers_init (void)
-{
-}
-
-gchar *
-mono_portability_find_file (const gchar *pathname, gboolean last_exists)
-{
-       g_assert_not_reached();
-       return NULL;
-}
-
-#else
+#ifndef DISABLE_PORTABILITY
 
 #include <dirent.h>
 
-int __mono_io_portability_helpers = PORTABILITY_UNKNOWN;
+int mono_io_portability_helpers = PORTABILITY_UNKNOWN;
 
 static inline gchar *mono_portability_find_file_internal (GString **report, const gchar *pathname, gboolean last_exists);
 
@@ -41,10 +21,10 @@ void mono_portability_helpers_init (void)
 {
         const gchar *env;
 
-       if (__mono_io_portability_helpers != PORTABILITY_UNKNOWN)
+       if (mono_io_portability_helpers != PORTABILITY_UNKNOWN)
                return;
        
-        __mono_io_portability_helpers = PORTABILITY_NONE;
+        mono_io_portability_helpers = PORTABILITY_NONE;
        
         env = g_getenv ("MONO_IOMAP");
         if (env != NULL) {
@@ -65,11 +45,11 @@ void mono_portability_helpers_init (void)
                                    options[i]);
 #endif
                         if (!strncasecmp (options[i], "drive", 5)) {
-                                __mono_io_portability_helpers |= PORTABILITY_DRIVE;
+                                mono_io_portability_helpers |= PORTABILITY_DRIVE;
                         } else if (!strncasecmp (options[i], "case", 4)) {
-                                __mono_io_portability_helpers |= PORTABILITY_CASE;
+                                mono_io_portability_helpers |= PORTABILITY_CASE;
                         } else if (!strncasecmp (options[i], "all", 3)) {
-                                __mono_io_portability_helpers |= (PORTABILITY_DRIVE | PORTABILITY_CASE);
+                                mono_io_portability_helpers |= (PORTABILITY_DRIVE | PORTABILITY_CASE);
                        }
                 }
        }
@@ -114,7 +94,6 @@ static gchar *find_in_dir (DIR *current, const gchar *name)
 
 static inline void append_report (GString **report, const gchar *format, ...)
 {
-#if GLIB_CHECK_VERSION(2,14,0)
        va_list ap;
        if (!*report)
                *report = g_string_new ("");
@@ -122,9 +101,6 @@ static inline void append_report (GString **report, const gchar *format, ...)
        va_start (ap, format);
        g_string_append_vprintf (*report, format, ap);
        va_end (ap);
-#else
-       g_assert_not_reached ();
-#endif
 }
 
 static inline void do_mono_profiler_iomap (GString **report, const char *pathname, const char *new_pathname)
@@ -147,7 +123,11 @@ static inline void do_mono_profiler_iomap (GString **report, const char *pathnam
 gchar *mono_portability_find_file (const gchar *pathname, gboolean last_exists)
 {
        GString *report = NULL;
-       gchar *ret = mono_portability_find_file_internal (&report, pathname, last_exists);
+       gchar *ret;
+       
+       if (!pathname || !pathname [0])
+               return NULL;
+       ret = mono_portability_find_file_internal (&report, pathname, last_exists);
 
        if (report)
                g_string_free (report, TRUE);
@@ -408,4 +388,9 @@ static inline gchar *mono_portability_find_file_internal (GString **report, cons
        g_free (new_pathname);
        return(NULL);
 }
-#endif
+
+#else /* DISABLE_PORTABILITY */
+
+MONO_EMPTY_SOURCE_FILE (mono_io_portability);
+
+#endif /* DISABLE_PORTABILITY */