Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / metadata / w32handle-namespace.c
index 1ca4e1dd8c57162da5177bc0eaacafe6fad0166c..f45d2efae532dc9487ed5719201516f42a87acaa 100644 (file)
@@ -1,5 +1,6 @@
-/*
- * w32handle-namespace.c: namespace for w32handles
+/**
+ * \file
+ * namespace for w32handles
  *
  * Author:
  *     Ludovic Henry (luhenry@microsoft.com)
@@ -16,7 +17,6 @@
 #include "w32mutex.h"
 #include "w32semaphore.h"
 #include "w32event.h"
-#include "mono/io-layer/io-layer.h"
 #include "mono/utils/mono-logger-internals.h"
 #include "mono/utils/mono-coop-mutex.h"
 
@@ -56,7 +56,7 @@ has_namespace (MonoW32HandleType type)
 typedef struct {
        gpointer ret;
        MonoW32HandleType type;
-       gchar *name;
+       const gchar *name;
 } NamespaceSearchHandleData;
 
 static gboolean
@@ -84,16 +84,14 @@ mono_w32handle_namespace_search_handle_callback (gpointer handle, gpointer data,
                if (type != search_data->type) {
                        /* Its the wrong type, so fail now */
                        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p matches name but is wrong type: %s",
-                               __func__, handle, mono_w32handle_ops_typename (type));
+                               __func__, handle, mono_w32handle_get_typename (type));
                        search_data->ret = INVALID_HANDLE_VALUE;
                } else {
                        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p matches name and type",
                                __func__, handle);
 
                        /* we do not want the handle to be destroyed before we return it  */
-                       mono_w32handle_ref (handle);
-
-                       search_data->ret = handle;
+                       search_data->ret = mono_w32handle_duplicate (handle);
                }
 
                return TRUE;
@@ -103,7 +101,7 @@ mono_w32handle_namespace_search_handle_callback (gpointer handle, gpointer data,
 }
 
 gpointer
-mono_w32handle_namespace_search_handle (MonoW32HandleType type, gchar *name)
+mono_w32handle_namespace_search_handle (MonoW32HandleType type, const gchar *name)
 {
        NamespaceSearchHandleData search_data;
 
@@ -111,7 +109,7 @@ mono_w32handle_namespace_search_handle (MonoW32HandleType type, gchar *name)
                g_error ("%s: type %s does not have a namespace", __func__, type);
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Lookup for handle named [%s] type %s",
-               __func__, name, mono_w32handle_ops_typename (type));
+               __func__, name, mono_w32handle_get_typename (type));
 
        search_data.ret = NULL;
        search_data.type = type;