Removed mostly unused SDL_errorcode

This commit is contained in:
Sam Lantinga
2024-05-07 15:04:17 -07:00
parent afe7c7a644
commit 04be04c338
9 changed files with 41 additions and 60 deletions

View File

@@ -59,7 +59,6 @@ int SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...)
return -1;
}
/* Available for backwards compatibility */
const char *SDL_GetError(void)
{
const SDL_error *error = SDL_GetErrBuf(SDL_FALSE);
@@ -88,22 +87,13 @@ int SDL_ClearError(void)
return 0;
}
/* Very common errors go here */
int SDL_Error(SDL_errorcode code)
int SDL_OutOfMemory(void)
{
switch (code) {
case SDL_ENOMEM:
SDL_GetErrBuf(SDL_TRUE)->error = SDL_ErrorCodeOutOfMemory;
return -1;
case SDL_EFREAD:
return SDL_SetError("Error reading from datastream");
case SDL_EFWRITE:
return SDL_SetError("Error writing to datastream");
case SDL_EFSEEK:
return SDL_SetError("Error seeking in datastream");
case SDL_UNSUPPORTED:
return SDL_SetError("That operation is not supported");
default:
return SDL_SetError("Unknown SDL error");
SDL_error *error = SDL_GetErrBuf(SDL_TRUE);
if (error) {
error->error = SDL_ErrorCodeOutOfMemory;
}
return -1;
}