Skip to content

Commit 858617b

Browse files
committed
Manually add SDL_free to FFI exports.
Also add SDL_calloc for later tests.
1 parent b54412b commit 858617b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

parse_sdl2.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ def parse(header: str, NEEDS_PACK4: bool) -> Iterator[str]:
132132
"SDL_version.h",
133133
]
134134

135+
# It's easier to manually add these instead of parsing SDL_stdinc.h
136+
CDEF_EXTRA = """
137+
void* SDL_calloc(size_t nmemb, size_t size);
138+
void SDL_free(void *mem);
139+
"""
140+
135141

136142
def add_to_ffi(ffi: cffi.FFI, path: Union[str, PathLike[str]]) -> None:
137143
path = Path(path)
@@ -148,6 +154,7 @@ def add_to_ffi(ffi: cffi.FFI, path: Union[str, PathLike[str]]) -> None:
148154
"\n".join(RE_TYPEDEF.findall(get_header(path / "SDL_stdinc.h"))).replace("SDLCALL ", ""),
149155
**cdef_args,
150156
)
157+
ffi.cdef(CDEF_EXTRA, **cdef_args)
151158
for header in HEADERS:
152159
try:
153160
for code in parse(get_header(path / header), NEEDS_PACK4):

0 commit comments

Comments
 (0)