[runtime] Avoid holding the init lock while calling the cctor in mono_runtime_class_i...
[mono-project.git] / support / stdlib.c
blob077a85e58f56388f1ab9357ccbfbc5f2ba8cdc4f
1 /*
2 * <stdlib.h> wrapper functions.
4 * Authors:
5 * Jonathan Pryor (jonpryor@vt.edu)
7 * Copyright (C) 2004-2005 Jonathan Pryor
8 */
10 #include <stdlib.h>
12 #include "map.h"
13 #include "mph.h"
15 G_BEGIN_DECLS
17 // See Stdlib.cs
18 void*
19 Mono_Unix_VersionString ()
21 return "MonoProject-2015-12-1";
24 gint32
25 Mono_Posix_Stdlib_EXIT_FAILURE (void)
27 return EXIT_FAILURE;
30 gint32
31 Mono_Posix_Stdlib_EXIT_SUCCESS (void)
33 return EXIT_SUCCESS;
36 gint32
37 Mono_Posix_Stdlib_MB_CUR_MAX (void)
39 return MB_CUR_MAX;
42 gint32
43 Mono_Posix_Stdlib_RAND_MAX (void)
45 return RAND_MAX;
48 void*
49 Mono_Posix_Stdlib_calloc (mph_size_t nmemb, mph_size_t size)
51 if (mph_have_size_t_overflow(nmemb) || mph_have_size_t_overflow(size))
52 return NULL;
54 return calloc ((size_t) nmemb, (size_t) size);
57 void*
58 Mono_Posix_Stdlib_malloc (mph_size_t size)
60 if (mph_have_size_t_overflow(size))
61 return NULL;
63 return malloc ((size_t) size);
66 void*
67 Mono_Posix_Stdlib_realloc (void* ptr, mph_size_t size)
69 if (mph_have_size_t_overflow(size))
70 return NULL;
72 return realloc (ptr, (size_t) size);
75 void
76 Mono_Posix_Stdlib_free (void* p)
78 free (p);
81 G_END_DECLS
84 * vim: noexpandtab