Make SDL_ObjectValid() inline for performance (thanks @mechakotik!)

This commit is contained in:
Sam Lantinga
2025-09-17 07:43:35 -07:00
parent 25b2d2c821
commit c25a0b046a
2 changed files with 18 additions and 11 deletions

View File

@@ -67,10 +67,25 @@ typedef enum
extern Uint32 SDL_GetNextObjectID(void);
extern void SDL_SetObjectValid(void *object, SDL_ObjectType type, bool valid);
extern bool SDL_ObjectValid(void *object, SDL_ObjectType type);
extern bool SDL_FindObject(void *object, SDL_ObjectType type);
extern int SDL_GetObjects(SDL_ObjectType type, void **objects, int count);
extern void SDL_SetObjectsInvalid(void);
extern bool SDL_object_validation;
SDL_FORCE_INLINE bool SDL_ObjectValid(void *object, SDL_ObjectType type)
{
if (!object) {
return false;
}
if (!SDL_object_validation) {
return true;
}
return SDL_FindObject(object, type);
}
extern const char *SDL_GetPersistentString(const char *string);
extern char *SDL_CreateDeviceName(Uint16 vendor, Uint16 product, const char *vendor_name, const char *product_name, const char *default_name);