taisei/src/util
Andrei Alexeyev b6978178b1
memory: use custom memory allocation wrappers
Introduces wrappers around memory allocation functions in `memory.h`
that should be used instead of the standard C ones.

These never return NULL and, with the exception of `mem_realloc()`,
zero-initialize the allocated memory like `calloc()` does.

All allocations made with the memory.h API must be deallocated with
`mem_free()`. Although standard `free()` will work on some platforms,
it's not portable (currently it won't work on Windows). Likewise,
`mem_free()` must not be used to free foreign allocations.

The standard C allocation functions are now diagnosed as deprecated.
They are, however, available with the `libc_` prefix in case interfacing
with foreign APIs is required. So far they are only used to implement
`memory.h`.

Perhaps the most important change is the introduction of the `ALLOC()`,
`ALLOC_ARRAY()`, and `ALLOC_FLEX()` macros. They take a type as a
parameter, and allocate enough memory with the correct alignment for
that type. That includes overaligned types as well. In most
circumstances you should prefer to use these macros. See the `memory.h`
header for some usage examples.
2023-01-18 13:23:22 +01:00
..
assert.c Abandon standard C conformance and require GNU extensions 2021-08-31 23:33:16 +03:00
assert.h build,log: make __FILE__ produce concise and consistent filenames 2022-09-01 05:50:55 +02:00
compat.h compat: add a few more attribute macros 2023-01-08 23:54:01 +01:00
compat_cmplx.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
consideredharmful.h memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
crap.c memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
crap.h memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
debug.c make upkeep script preserve existing copyrights 2019-08-03 20:44:22 +03:00
debug.h build,log: make __FILE__ produce concise and consistent filenames 2022-09-01 05:50:55 +02:00
env.c windows: detect intel's shitty driver and fall back to ANGLE 2019-09-21 16:46:22 +03:00
env.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
fbmgr.c memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
fbmgr.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
fbpair.c New system to manage auto-resized framebuffers 2019-08-25 02:52:39 +03:00
fbpair.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
fbutil.c New system to manage auto-resized framebuffers 2019-08-25 02:52:39 +03:00
fbutil.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
gamemode.c GameMode integration (#258) 2020-11-19 01:12:51 +02:00
gamemode.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
gamemode_stub.c GameMode integration (#258) 2020-11-19 01:12:51 +02:00
geometry.c util/geometry: fix bad assumption in lineseg_closest_factor_impl 2021-12-21 23:11:02 +02:00
geometry.h util/geometry: add as_array accessors to FloatOffset, FloatExtent, and FloatRect 2023-01-14 15:00:54 +01:00
glm.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
graphics.c Texturing overhaul: GPU compression, sRGB sampling, swizzles, etc. (#240) 2020-08-15 14:51:12 +03:00
graphics.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
io.c memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
io.h util/io: add SDL_RWsync function 2022-07-12 01:57:35 +03:00
kvparser.c memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
kvparser.h pbr: refactor material management and shader 2021-09-01 00:21:50 +03:00
libzip_compat.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
macrohax.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
meson.build compat: add a few more attribute macros 2023-01-08 23:54:01 +01:00
miscmath.c Abandon standard C conformance and require GNU extensions 2021-08-31 23:33:16 +03:00
miscmath.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
platform_posix.c blind fix for macos crap 2021-04-29 20:44:26 +03:00
platform_win32.c make upkeep script preserve existing copyrights 2019-08-03 20:44:22 +03:00
pngcruft.c memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
pngcruft.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
rectpack.c memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
rectpack.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
sha256.c memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
sha256.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
sha256_openssl.c util/sha256_openssl: fix libressl compat 2022-05-25 04:49:39 +03:00
strbuf.c memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
strbuf.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00
stringops.c memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
stringops.h memory: use custom memory allocation wrappers 2023-01-18 13:23:22 +01:00
systime.h replace include guards with #pragma once 2021-08-31 23:34:46 +03:00