[mcs] Implements C# 7.2 readonly structs
[mono.git] / mono / utils / mono-io-portability.c
index 54c6320d2b6f6a08bc8fc2fe249f315bbde8cac8..d4763a569b9fd332efcd3318c1e0dc05fd162d12 100644 (file)
@@ -1,3 +1,7 @@
+/**
+ * \file
+ */
+
 #include "config.h"
 
 #include <string.h>
@@ -7,6 +11,7 @@
 #include <errno.h>
 #include <mono/utils/mono-io-portability.h>
 #include <mono/metadata/profiler-private.h>
+#include <mono/utils/mono-compiler.h>
 
 #ifndef DISABLE_PORTABILITY
 
@@ -18,7 +23,7 @@ static inline gchar *mono_portability_find_file_internal (GString **report, cons
 
 void mono_portability_helpers_init (void)
 {
-        const gchar *env;
+        gchar *env;
 
        if (mono_io_portability_helpers != PORTABILITY_UNKNOWN)
                return;
@@ -51,6 +56,7 @@ void mono_portability_helpers_init (void)
                                 mono_io_portability_helpers |= (PORTABILITY_DRIVE | PORTABILITY_CASE);
                        }
                 }
+               g_free (env);
        }
 }
 
@@ -115,7 +121,7 @@ static inline void do_mono_profiler_iomap (GString **report, const char *pathnam
                *report = NULL;
        }
 
-       mono_profiler_iomap (rep, pathname, new_pathname);
+       MONO_PROFILER_RAISE (iomap_report, (rep, pathname, new_pathname));
        g_free (rep);
 }
 
@@ -142,7 +148,7 @@ static inline gchar *mono_portability_find_file_internal (GString **report, cons
        DIR *scanning = NULL;
        size_t len;
        gboolean drive_stripped = FALSE;
-       gboolean do_report = (mono_profiler_get_events () & MONO_PROFILE_IOMAP_EVENTS) != 0;
+       gboolean do_report = MONO_PROFILER_ENABLED (iomap_report);
 
        if (IS_PORTABILITY_NONE) {
                return(NULL);
@@ -387,4 +393,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 */