1 /** 2 * Compiler implementation of the 3 * $(LINK2 http://www.dlang.org, D programming language). 4 * 5 * Copyright: Copyright (C) 1985-1998 by Symantec 6 * Copyright (C) 2000-2019 by The D Language Foundation, All Rights Reserved 7 * Authors: $(LINK2 http://www.digitalmars.com, Walter Bright) 8 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) 9 * Source: $(LINK2 https://github.com/dlang/dmd/blob/master/src/dmd/backend/memh.d, backend/memh.d) 10 * Coverage: https://codecov.io/gh/dlang/dmd/src/master/src/dmd/backend/memh.d 11 */ 12 13 14 module dmd.backend.memh; 15 16 17 extern (C): 18 19 nothrow: 20 @nogc: 21 22 char *mem_strdup(const(char) *); 23 void *mem_malloc(size_t); 24 void *mem_calloc(size_t); 25 void *mem_realloc(void *,size_t); 26 void mem_free(void *); 27 void mem_init(); 28 void mem_term(); 29 30 extern (C++) 31 { 32 void mem_free_cpp(void *); 33 alias mem_freefp = mem_free_cpp; 34 } 35 36 enum MEM_E { MEM_ABORTMSG, MEM_ABORT, MEM_RETNULL, MEM_CALLFP, MEM_RETRY } 37 void mem_setexception(MEM_E,...); 38 39 version (MEM_DEBUG) 40 { 41 alias mem_fstrdup = mem_strdup; 42 alias mem_fcalloc = mem_calloc; 43 alias mem_fmalloc = mem_malloc; 44 alias mem_ffree = mem_free; 45 } 46 else 47 { 48 char *mem_fstrdup(const(char) *); 49 void *mem_fcalloc(size_t); 50 void *mem_fmalloc(size_t); 51 void mem_ffree(void *) { } 52 }