Merge pull request #2816 from xmcclure/profile-clean-0
[mono.git] / mono / metadata / string-icalls.c
index 773613c669283ddb99ca1bcc946a5754d544096f..be330aa413a76fb8e08c626c6851795937d005ce 100644 (file)
@@ -7,6 +7,7 @@
  *
  * Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
  * Copyright 2004-2009 Novell, Inc (http://www.novell.com)
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 #include <config.h>
 #include <stdlib.h>
@@ -36,17 +37,22 @@ ves_icall_System_String_ctor_RedirectToCreateString (void)
 MonoString *
 ves_icall_System_String_InternalAllocateStr (gint32 length)
 {
-       return mono_string_new_size(mono_domain_get (), length);
+       MonoError error;
+       MonoString *str = mono_string_new_size_checked (mono_domain_get (), length, &error);
+       mono_error_raise_exception (&error);
+
+       return str;
 }
 
 MonoString  *
 ves_icall_System_String_InternalIntern (MonoString *str)
 {
+       MonoError error;
        MonoString *res;
 
-       res = mono_string_intern(str);
+       res = mono_string_intern_checked (str, &error);
        if (!res) {
-               mono_set_pending_exception (mono_domain_get ()->out_of_memory_ex);
+               mono_error_set_pending_exception (&error);
                return NULL;
        }
        return res;
@@ -55,7 +61,7 @@ ves_icall_System_String_InternalIntern (MonoString *str)
 MonoString * 
 ves_icall_System_String_InternalIsInterned (MonoString *str)
 {
-       return mono_string_is_interned(str);
+       return mono_string_is_interned (str);
 }
 
 int