all repos — mgba @ a2dc6557e387815fd8b7253c2030139bac4fcadf

mGBA Game Boy Advance Emulator

Util: Add default memory.c implementation
Vicki Pfau vi@endrift.com
Sun, 08 Nov 2020 00:38:15 -0800
commit

a2dc6557e387815fd8b7253c2030139bac4fcadf

parent

9edbe75ff8c2741b1e7a9c54718f849227d7941b

M src/platform/switch/CMakeLists.txtsrc/platform/switch/CMakeLists.txt

@@ -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 @@ list(APPEND OS_LIB nx)

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)
M src/platform/switch/memory.csrc/util/memory.c

@@ -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 @@ * 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); + return calloc(1, size); } void mappedMemoryFree(void* memory, size_t size) {
M src/platform/wii/CMakeLists.txtsrc/platform/wii/CMakeLists.txt

@@ -8,9 +8,7 @@ list(APPEND CORE_VFS_SRC ${CMAKE_SOURCE_DIR}/src/util/vfs/vfs-file.c ${CMAKE_SOURCE_DIR}/src/util/vfs/vfs-dirent.c ${CMAKE_SOURCE_DIR}/src/util/vfs/vfs-devlist.c)

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)
D src/platform/wii/wii-memory.c

@@ -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); -}
M src/util/CMakeLists.txtsrc/util/CMakeLists.txt

@@ -30,10 +30,15 @@ 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}) export_directory(UTIL SOURCE_FILES) export_directory(GUI GUI_FILES) -export_directory(UTIL_TEST TEST_FILES)+export_directory(UTIL_TEST TEST_FILES)