mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 18:05:31 +00:00
SDL_dynapi.c: add missing SDLCALL to macros.
This commit is contained in:
parent
a38f127e88
commit
b7c5d15152
|
@ -62,38 +62,38 @@ static void SDL_InitDynamicAPI(void);
|
||||||
#if DISABLE_JUMP_MAGIC
|
#if DISABLE_JUMP_MAGIC
|
||||||
/* Can't use the macro for varargs nonsense. This is atrocious. */
|
/* Can't use the macro for varargs nonsense. This is atrocious. */
|
||||||
#define SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, logname, prio) \
|
#define SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, logname, prio) \
|
||||||
_static void SDL_Log##logname##name(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \
|
_static void SDLCALL SDL_Log##logname##name(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \
|
||||||
va_list ap; initcall; va_start(ap, fmt); \
|
va_list ap; initcall; va_start(ap, fmt); \
|
||||||
jump_table.SDL_LogMessageV(category, SDL_LOG_PRIORITY_##prio, fmt, ap); \
|
jump_table.SDL_LogMessageV(category, SDL_LOG_PRIORITY_##prio, fmt, ap); \
|
||||||
va_end(ap); \
|
va_end(ap); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SDL_DYNAPI_VARARGS(_static, name, initcall) \
|
#define SDL_DYNAPI_VARARGS(_static, name, initcall) \
|
||||||
_static int SDL_SetError##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \
|
_static int SDLCALL SDL_SetError##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \
|
||||||
char buf[512]; /* !!! FIXME: dynamic allocation */ \
|
char buf[512]; /* !!! FIXME: dynamic allocation */ \
|
||||||
va_list ap; initcall; va_start(ap, fmt); \
|
va_list ap; initcall; va_start(ap, fmt); \
|
||||||
jump_table.SDL_vsnprintf(buf, sizeof (buf), fmt, ap); \
|
jump_table.SDL_vsnprintf(buf, sizeof (buf), fmt, ap); \
|
||||||
va_end(ap); \
|
va_end(ap); \
|
||||||
return jump_table.SDL_SetError("%s", buf); \
|
return jump_table.SDL_SetError("%s", buf); \
|
||||||
} \
|
} \
|
||||||
_static int SDL_sscanf##name(const char *buf, SDL_SCANF_FORMAT_STRING const char *fmt, ...) { \
|
_static int SDLCALL SDL_sscanf##name(const char *buf, SDL_SCANF_FORMAT_STRING const char *fmt, ...) { \
|
||||||
int retval; va_list ap; initcall; va_start(ap, fmt); \
|
int retval; va_list ap; initcall; va_start(ap, fmt); \
|
||||||
retval = jump_table.SDL_vsscanf(buf, fmt, ap); \
|
retval = jump_table.SDL_vsscanf(buf, fmt, ap); \
|
||||||
va_end(ap); \
|
va_end(ap); \
|
||||||
return retval; \
|
return retval; \
|
||||||
} \
|
} \
|
||||||
_static int SDL_snprintf##name(SDL_OUT_Z_CAP(maxlen) char *buf, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \
|
_static int SDLCALL SDL_snprintf##name(SDL_OUT_Z_CAP(maxlen) char *buf, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \
|
||||||
int retval; va_list ap; initcall; va_start(ap, fmt); \
|
int retval; va_list ap; initcall; va_start(ap, fmt); \
|
||||||
retval = jump_table.SDL_vsnprintf(buf, maxlen, fmt, ap); \
|
retval = jump_table.SDL_vsnprintf(buf, maxlen, fmt, ap); \
|
||||||
va_end(ap); \
|
va_end(ap); \
|
||||||
return retval; \
|
return retval; \
|
||||||
} \
|
} \
|
||||||
_static void SDL_Log##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \
|
_static void SDLCALL SDL_Log##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \
|
||||||
va_list ap; initcall; va_start(ap, fmt); \
|
va_list ap; initcall; va_start(ap, fmt); \
|
||||||
jump_table.SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, fmt, ap); \
|
jump_table.SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, fmt, ap); \
|
||||||
va_end(ap); \
|
va_end(ap); \
|
||||||
} \
|
} \
|
||||||
_static void SDL_LogMessage##name(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \
|
_static void SDLCALL SDL_LogMessage##name(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \
|
||||||
va_list ap; initcall; va_start(ap, fmt); \
|
va_list ap; initcall; va_start(ap, fmt); \
|
||||||
jump_table.SDL_LogMessageV(category, priority, fmt, ap); \
|
jump_table.SDL_LogMessageV(category, priority, fmt, ap); \
|
||||||
va_end(ap); \
|
va_end(ap); \
|
||||||
|
@ -111,9 +111,9 @@ static void SDL_InitDynamicAPI(void);
|
||||||
/* The DEFAULT funcs will init jump table and then call real function. */
|
/* The DEFAULT funcs will init jump table and then call real function. */
|
||||||
/* The REAL funcs are the actual functions, name-mangled to not clash. */
|
/* The REAL funcs are the actual functions, name-mangled to not clash. */
|
||||||
#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \
|
#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \
|
||||||
typedef rc (*SDL_DYNAPIFN_##fn) params; \
|
typedef rc (SDLCALL *SDL_DYNAPIFN_##fn) params; \
|
||||||
static rc fn##_DEFAULT params; \
|
static rc SDLCALL fn##_DEFAULT params; \
|
||||||
extern rc fn##_REAL params;
|
extern rc SDLCALL fn##_REAL params;
|
||||||
#include "SDL_dynapi_procs.h"
|
#include "SDL_dynapi_procs.h"
|
||||||
#undef SDL_DYNAPI_PROC
|
#undef SDL_DYNAPI_PROC
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ typedef struct {
|
||||||
} SDL_DYNAPI_jump_table;
|
} SDL_DYNAPI_jump_table;
|
||||||
|
|
||||||
/* Predeclare the default functions for initializing the jump table. */
|
/* Predeclare the default functions for initializing the jump table. */
|
||||||
#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) static rc fn##_DEFAULT params;
|
#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) static rc SDLCALL fn##_DEFAULT params;
|
||||||
#include "SDL_dynapi_procs.h"
|
#include "SDL_dynapi_procs.h"
|
||||||
#undef SDL_DYNAPI_PROC
|
#undef SDL_DYNAPI_PROC
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ static SDL_DYNAPI_jump_table jump_table = {
|
||||||
/* Default functions init the function table then call right thing. */
|
/* Default functions init the function table then call right thing. */
|
||||||
#if DISABLE_JUMP_MAGIC
|
#if DISABLE_JUMP_MAGIC
|
||||||
#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \
|
#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \
|
||||||
static rc fn##_DEFAULT params { \
|
static rc SDLCALL fn##_DEFAULT params { \
|
||||||
SDL_InitDynamicAPI(); \
|
SDL_InitDynamicAPI(); \
|
||||||
ret jump_table.fn args; \
|
ret jump_table.fn args; \
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ SDL_DYNAPI_VARARGS(static, _DEFAULT, SDL_InitDynamicAPI())
|
||||||
/* Public API functions to jump into the jump table. */
|
/* Public API functions to jump into the jump table. */
|
||||||
#if DISABLE_JUMP_MAGIC
|
#if DISABLE_JUMP_MAGIC
|
||||||
#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \
|
#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \
|
||||||
rc fn params { ret jump_table.fn args; }
|
rc SDLCALL fn params { ret jump_table.fn args; }
|
||||||
#define SDL_DYNAPI_PROC_NO_VARARGS 1
|
#define SDL_DYNAPI_PROC_NO_VARARGS 1
|
||||||
#include "SDL_dynapi_procs.h"
|
#include "SDL_dynapi_procs.h"
|
||||||
#undef SDL_DYNAPI_PROC
|
#undef SDL_DYNAPI_PROC
|
||||||
|
|
Loading…
Reference in a new issue