Mozilla/mozilla/tools/leaky/LibPreload.cpp
dmose%mozilla.org 0efb7c174c updated xPL license boilerplate to v1.1, a=chofmann@netscape.com,r=endico@mozilla.org
git-svn-id: svn://10.0.0.236/trunk@52910 18797224-902f-48f8-a5cc-f745e15eee43
1999-11-06 03:43:54 +00:00

30 lines
1.0 KiB
C++

// The contents of this file are subject to the Mozilla Public License
// Version 1.1 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License
// at http://www.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
// the License for the specific language governing rights and
// limitations under the License.
//
// The Initial Developer of the Original Code is Kipp E.B. Hickman.
#include "TestPreload.h"
#include "config.h"
#include <malloc.h>
// This is a fake implementation of malloc that layers on top of the
// native platforms malloc routine (ideally using weak symbols). What
// it does if given a specail size request it returns a fake address
// result, otherwise it uses the underlying malloc.
void* malloc(size_t aSize)
{
if (aSize == LD_PRELOAD_TEST_MALLOC_SIZE) {
return (void*) LD_PRELOAD_TEST_VALUE;
}
else {
return REAL_MALLOC(aSize);
}
}