mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 11:21:08 -10:00
* Fix compiler warnings (w32) - add explicit (long long (unsigned)) type casts - change %ld to %lld once, to match the general style of these logging messages * Fix compiler warnings (threadpool) - add explicit (void *) type casts * Fix compiler warnings (boehm) - add an explicit (long) type cast; the values are defined as gint64, an upgrade to at least "%ld" seems like a good idea - about dropping const: const does not seem to be necessary as g_getenv() returns pointers to freshly allocated buffers whenever called. const might have been used to protect the return value of g_getenv() on unix systems with earlier versions of Mono (as a comment in gmisc-unix.c suggests). keeping const here causes a compiler warning, as the const qualifier gets dropped when *env is being used with g_free(). that led to the decision to drop the qualifier altogether. * Fix compiler warnings (sgen) - specify the arguments (void) to avoid -Wstrict-prototypes warnings * Fix compiler warnings (misc - metadata) - specify the arguments (void) to avoid -Wstrict-prototypes warnings * Fix compiler warnings (misc) - specify the arguments (void) to avoid -Wstrict-prototypes warnings - add an explicit (void *) type cast; changing the return type to char* might be more usable and could be discussed - ret is not being used and can be removed; fixes a -Wunused-but-set-variable warning * Fix compiler warnings (mini) - specify the arguments (void) to avoid -Wstrict-prototypes warnings * [fixup!] Correct indentation * [fixup!] Correct (void *) - use GUINT_TO_POINTER and MONO_NATIVE_THREAD_ID_TO_UINT instead of (void *) to cast mono_native_thread_id_get () to %p * [fixup!] Correct indentation of boehm-gc.c and add FIXME * include <inttypes.h> and test the G_GINT64_FORMAT macro * [fixup!] Use G_G*_FORMAT and PRIx32 macros instead of type casts wherever possible
86 lines
1.2 KiB
C
86 lines
1.2 KiB
C
/*
|
|
* <stdlib.h> wrapper functions.
|
|
*
|
|
* Authors:
|
|
* Jonathan Pryor ([email protected])
|
|
*
|
|
* Copyright (C) 2004-2005 Jonathan Pryor
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "map.h"
|
|
#include "mph.h"
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
// See Stdlib.cs
|
|
void*
|
|
Mono_Unix_VersionString ()
|
|
{
|
|
return (void *) "MonoProject-2015-12-1";
|
|
}
|
|
|
|
gint32
|
|
Mono_Posix_Stdlib_EXIT_FAILURE (void)
|
|
{
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
gint32
|
|
Mono_Posix_Stdlib_EXIT_SUCCESS (void)
|
|
{
|
|
return EXIT_SUCCESS;
|
|
}
|
|
|
|
gint32
|
|
Mono_Posix_Stdlib_MB_CUR_MAX (void)
|
|
{
|
|
return MB_CUR_MAX;
|
|
}
|
|
|
|
gint32
|
|
Mono_Posix_Stdlib_RAND_MAX (void)
|
|
{
|
|
return RAND_MAX;
|
|
}
|
|
|
|
void*
|
|
Mono_Posix_Stdlib_calloc (mph_size_t nmemb, mph_size_t size)
|
|
{
|
|
if (mph_have_size_t_overflow(nmemb) || mph_have_size_t_overflow(size))
|
|
return NULL;
|
|
|
|
return calloc ((size_t) nmemb, (size_t) size);
|
|
}
|
|
|
|
void*
|
|
Mono_Posix_Stdlib_malloc (mph_size_t size)
|
|
{
|
|
if (mph_have_size_t_overflow(size))
|
|
return NULL;
|
|
|
|
return malloc ((size_t) size);
|
|
}
|
|
|
|
void*
|
|
Mono_Posix_Stdlib_realloc (void* ptr, mph_size_t size)
|
|
{
|
|
if (mph_have_size_t_overflow(size))
|
|
return NULL;
|
|
|
|
return realloc (ptr, (size_t) size);
|
|
}
|
|
|
|
void
|
|
Mono_Posix_Stdlib_free (void* p)
|
|
{
|
|
free (p);
|
|
}
|
|
|
|
G_END_DECLS
|
|
|
|
/*
|
|
* vim: noexpandtab
|
|
*/
|