Fix the build
[mono-project.git] / support / stdlib.c
blob56df107016f6d1c4affdf29d4d81ecf3ab27e4a7
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 gint32
18 Mono_Posix_Stdlib_EXIT_FAILURE (void)
20 return EXIT_FAILURE;
23 gint32
24 Mono_Posix_Stdlib_EXIT_SUCCESS (void)
26 return EXIT_SUCCESS;
29 gint32
30 Mono_Posix_Stdlib_MB_CUR_MAX (void)
32 return MB_CUR_MAX;
35 gint32
36 Mono_Posix_Stdlib_RAND_MAX (void)
38 return RAND_MAX;
41 void*
42 Mono_Posix_Stdlib_calloc (mph_size_t nmemb, mph_size_t size)
44 if (mph_have_size_t_overflow(nmemb) || mph_have_size_t_overflow(size))
45 return NULL;
47 return calloc ((size_t) nmemb, (size_t) size);
50 void*
51 Mono_Posix_Stdlib_malloc (mph_size_t size)
53 if (mph_have_size_t_overflow(size))
54 return NULL;
56 return malloc ((size_t) size);
59 void*
60 Mono_Posix_Stdlib_realloc (void* ptr, mph_size_t size)
62 if (mph_have_size_t_overflow(size))
63 return NULL;
65 return realloc (ptr, (size_t) size);
68 G_END_DECLS
71 * vim: noexpandtab