mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-09 12:58:41 +03:00
use pragma warning only on msvc (issue #291)
This commit is contained in:
parent
d73d6beb71
commit
032eb2a75a
3 changed files with 15 additions and 8 deletions
|
@ -14,6 +14,11 @@ terms of the MIT license. A copy of the license can be found in the file
|
|||
#include <ctype.h> // toupper
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4996) // strncpy, strncat
|
||||
#endif
|
||||
|
||||
|
||||
static uintptr_t mi_max_error_count = 16; // stop outputting errors after this
|
||||
|
||||
static void mi_add_stderr_output();
|
||||
|
@ -215,7 +220,6 @@ static void mi_out_buf_stderr(const char* msg, void* arg) {
|
|||
|
||||
// Should be atomic but gives errors on many platforms as generally we cannot cast a function pointer to a uintptr_t.
|
||||
// For now, don't register output from multiple threads.
|
||||
#pragma warning(suppress:4180)
|
||||
static mi_output_fun* volatile mi_out_default; // = NULL
|
||||
static _Atomic(void*) mi_out_arg; // = NULL
|
||||
|
||||
|
@ -389,13 +393,11 @@ void _mi_error_message(int err, const char* fmt, ...) {
|
|||
|
||||
static void mi_strlcpy(char* dest, const char* src, size_t dest_size) {
|
||||
dest[0] = 0;
|
||||
#pragma warning(suppress:4996)
|
||||
strncpy(dest, src, dest_size - 1);
|
||||
dest[dest_size - 1] = 0;
|
||||
}
|
||||
|
||||
static void mi_strlcat(char* dest, const char* src, size_t dest_size) {
|
||||
#pragma warning(suppress:4996)
|
||||
strncat(dest, src, dest_size - 1);
|
||||
dest[dest_size - 1] = 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue