Util: Add default memory.c implementation

This commit is contained in:
Vicki Pfau 2020-11-08 00:38:15 -08:00
parent 9edbe75ff8
commit a2dc6557e3
5 changed files with 8 additions and 22 deletions

View File

@ -10,7 +10,6 @@ list(APPEND GUI_SRC ${CMAKE_CURRENT_SOURCE_DIR}/gui-font.c)
include_directories(AFTER ${OPENGLES3_INCLUDE_DIR} ${OPENGL_EGL_INCLUDE_DIR})
file(GLOB OS_SRC ${CMAKE_SOURCE_DIR}/src/platform/wii/wii-*.c)
if(${CMAKE_BUILD_TYPE} STREQUAL Debug OR ${CMAKE_BUILD_TYPE} STREQUAL RelWithDebInfo)
find_library(NOUVEAU_LIBRARY drm_nouveaud REQUIRED)
list(APPEND OS_LIB nxd)
@ -20,7 +19,6 @@ else()
endif()
set(CORE_VFS_SRC ${CORE_VFS_SRC} PARENT_SCOPE)
set(OS_DEFINES ${OS_DEFINES} PARENT_SCOPE)
set(OS_SRC ${OS_SRC} PARENT_SCOPE)
set(OS_LIB ${OS_LIB} PARENT_SCOPE)
if(BUILD_PERF)

View File

@ -8,9 +8,7 @@ list(APPEND CORE_VFS_SRC ${CMAKE_SOURCE_DIR}/src/util/vfs/vfs-file.c ${CMAKE_SOU
include_directories(${CMAKE_CURRENT_BINARY_DIR})
file(GLOB OS_SRC ${CMAKE_SOURCE_DIR}/src/platform/wii/wii-*.c)
list(APPEND OS_LIB wiiuse bte fat ogc)
set(OS_SRC ${OS_SRC} PARENT_SCOPE)
set(OS_LIB ${OS_LIB} PARENT_SCOPE)
source_group("Wii-specific code" FILES ${OS_SRC})
set(CORE_VFS_SRC ${CORE_VFS_SRC} PARENT_SCOPE)

View File

@ -1,15 +0,0 @@
/* Copyright (c) 2013-2015 Jeffrey Pfau
*
* 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 <mgba-util/memory.h>
void* anonymousMemoryMap(size_t size) {
return malloc(size);
}
void mappedMemoryFree(void* memory, size_t size) {
UNUSED(size);
free(memory);
}

View File

@ -30,6 +30,11 @@ set(TEST_FILES
test/text-codec.c
test/vfs.c)
if(NOT DEFINED OS_SRC)
set(OS_FILES memory.c)
export_directory(OS OS_FILES)
endif()
source_group("Utilities" FILES ${SOURCE_FILES})
source_group("GUI source" FILES ${GUI_FILES})
source_group("Utilities tests" FILES ${TEST_FILES})

View File

@ -1,4 +1,4 @@
/* Copyright (c) 2013-2018 Jeffrey Pfau
/* Copyright (c) 2013-2020 Jeffrey Pfau
*
* 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
@ -6,7 +6,7 @@
#include <mgba-util/memory.h>
void* anonymousMemoryMap(size_t size) {
return malloc(size);
return calloc(1, size);
}
void mappedMemoryFree(void* memory, size_t size) {