Skip to content

Commit

Permalink
Remove unused code (dotnet#70624)
Browse files Browse the repository at this point in the history
* Remove unused AllowZeroAllocator and
DefaultAllocator.

* Remove static_assert_n.

* Remove the native Regex implementation and replace
with a minimal version from TPOP.

Add attribution in third party notices.
  • Loading branch information
AaronRobinsonMSFT authored Jun 12, 2022
1 parent ffff070 commit f1f940f
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 1,299 deletions.
10 changes: 10 additions & 0 deletions THIRD-PARTY-NOTICES.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -1099,3 +1099,13 @@ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

License notice for code from The Practice of Programming
-------------------------------

Copyright (C) 1999 Lucent Technologies

Excerpted from 'The Practice of Programming
by Brian W. Kernighan and Rob Pike

You may use this code for any purpose, as long as you leave the copyright notice and book citation attached.
48 changes: 0 additions & 48 deletions src/coreclr/inc/defaultallocator.h

This file was deleted.

44 changes: 0 additions & 44 deletions src/coreclr/inc/iallocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,48 +29,4 @@ class IAllocator
virtual void Free(void* p) = 0;
};

// This class wraps an allocator that does not allow zero-length allocations,
// producing one that does (every zero-length allocation produces a pointer to the same
// statically-allocated memory, and freeing that pointer is a no-op).
class AllowZeroAllocator: public IAllocator
{
int m_zeroLenAllocTarg;
IAllocator* m_alloc;

public:
AllowZeroAllocator(IAllocator* alloc) : m_alloc(alloc) {}

void* Alloc(size_t sz)
{
if (sz == 0)
{
return (void*)(&m_zeroLenAllocTarg);
}
else
{
return m_alloc->Alloc(sz);
}
}

void* ArrayAlloc(size_t elemSize, size_t numElems)
{
if (elemSize == 0 || numElems == 0)
{
return (void*)(&m_zeroLenAllocTarg);
}
else
{
return m_alloc->ArrayAlloc(elemSize, numElems);
}
}

virtual void Free(void * p)
{
if (p != (void*)(&m_zeroLenAllocTarg))
{
m_alloc->Free(p);
}
}
};

#endif // _IALLOCATOR_DEFINED_
Loading

0 comments on commit f1f940f

Please sign in to comment.