X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/5dd5f9ec28f304ca377c42fd7f711d6cf12b90e1..5c19dc3ae3bd8e40a9c028b0deddd50ff337692c:/Security/libsecurity_cryptkit/lib/falloc.c diff --git a/Security/libsecurity_cryptkit/lib/falloc.c b/Security/libsecurity_cryptkit/lib/falloc.c deleted file mode 100644 index 8a41af7b..00000000 --- a/Security/libsecurity_cryptkit/lib/falloc.c +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright (c) 1998,2011,2014 Apple Inc. All Rights Reserved. - * - * NOTICE: USE OF THE MATERIALS ACCOMPANYING THIS NOTICE IS SUBJECT - * TO THE TERMS OF THE SIGNED "FAST ELLIPTIC ENCRYPTION (FEE) REFERENCE - * SOURCE CODE EVALUATION AGREEMENT" BETWEEN APPLE, INC. AND THE - * ORIGINAL LICENSEE THAT OBTAINED THESE MATERIALS FROM APPLE, - * INC. ANY USE OF THESE MATERIALS NOT PERMITTED BY SUCH AGREEMENT WILL - * EXPOSE YOU TO LIABILITY. - *************************************************************************** - * - * falloc.c - FEE malloc routines - * - * Revision History - * ---------------- - * 28 May 98 at Apple - * Added Mac-specific allocators from temp memory - * 20 Aug 96 at NeXT - * Created. - */ - -#include "platform.h" -#include "falloc.h" -#include - -/* watchpoint emulator */ -#define FALLOC_WATCH 0 -#if FALLOC_WATCH -#include -/* set these with debugger */ -void *mallocWatchAddrs; -void *freeWatchAddrs; -#endif - -/* if NULL, use our own */ -static mallocExternFcn *mallocExt = NULL; -static freeExternFcn *freeExt = NULL; -static reallocExternFcn *reallocExt = NULL; - -void fallocRegister(mallocExternFcn *mallocExtern, - freeExternFcn *freeExtern, - reallocExternFcn *reallocExtern) -{ - mallocExt = mallocExtern; - freeExt = freeExtern; - reallocExt = reallocExtern; -} - -/* - * All this can be optimized and tailored to specific platforms, of course... - */ - -void *fmalloc(unsigned size) -{ - void *rtn; - if(mallocExt != NULL) { - rtn = (mallocExt)(size); - } - else { - rtn = malloc(size); - } - #if FALLOC_WATCH - if(rtn == mallocWatchAddrs) { - printf("====fmalloc watchpoint (0x%x) hit\n", - (unsigned)mallocWatchAddrs); - } - #endif - return rtn; -} - -void *fmallocWithData(const void *origData, - unsigned origDataLen) -{ - void *rtn = fmalloc(origDataLen); - - bcopy(origData, rtn, origDataLen); - return rtn; -} - -void ffree(void *data) -{ - #if FALLOC_WATCH - if(data == freeWatchAddrs) { - printf("====ffree watchpoint (0x%x) hit\n", - (unsigned)freeWatchAddrs); - } - #endif - if(freeExt != NULL) { - (freeExt)(data); - } - else { - free(data); - } -} - -void *frealloc(void *oldPtr, unsigned newSize) -{ - #if FALLOC_WATCH - if(oldPtr == freeWatchAddrs) { - printf("====frealloc watchpoint (0x%x) hit\n", - (unsigned)freeWatchAddrs); - } - #endif - if(reallocExt != NULL) { - return (reallocExt)(oldPtr, newSize); - } - else { - return realloc(oldPtr, newSize); - } -}