[nostalgia/core/gba][ox/std] Move heap manager from NostalgiaCore to OxStd

This commit is contained in:
2020-05-29 19:36:00 -05:00
parent 0eb33f823c
commit 98a0c42040
11 changed files with 108 additions and 74 deletions
+8 -16
View File
@@ -1,3 +1,10 @@
/*
* Copyright 2016 - 2020 gtalent2@gmail.com
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <map>
#include <string>
@@ -5,9 +12,7 @@
#include <ox/std/std.hpp>
#include <nostalgia/core/mem.hpp>
namespace nostalgia::core {
namespace ox::heapmgr {
[[nodiscard]] void *malloc(std::size_t allocSize);
@@ -17,20 +22,7 @@ void initHeap(char *heapBegin, char *heapEnd);
}
using namespace nostalgia;
int testMalloc(std::string) {
std::vector<char> buff(ox::units::MB);
core::initHeap(&buff.front(), &buff.back());
oxAssert(core::malloc(5) != nullptr, "malloc is broken");
oxAssert(core::malloc(5) != nullptr, "malloc is broken");
return 0;
}
std::map<std::string, int(*)(std::string)> tests = {
{
{ "malloc", testMalloc },
}
};
int main(int argc, const char **args) {