/*1Simple DirectMedia Layer2Copyright (C) 1997-2025 Sam Lantinga <[email protected]>34This software is provided 'as-is', without any express or implied5warranty. In no event will the authors be held liable for any damages6arising from the use of this software.78Permission is granted to anyone to use this software for any purpose,9including commercial applications, and to alter it and redistribute it10freely, subject to the following restrictions:11121. The origin of this software must not be misrepresented; you must not13claim that you wrote the original software. If you use this software14in a product, an acknowledgment in the product documentation would be15appreciated but is not required.162. Altered source versions must be plainly marked as such, and must not be17misrepresented as being the original software.183. This notice may not be removed or altered from any source distribution.19*/20#include "SDL_internal.h"2122/* This file defines a structure that carries language-independent23error messages24*/2526#ifndef SDL_error_c_h_27#define SDL_error_c_h_2829typedef enum30{31SDL_ErrorCodeNone,32SDL_ErrorCodeGeneric,33SDL_ErrorCodeOutOfMemory,34} SDL_ErrorCode;3536typedef struct SDL_error37{38SDL_ErrorCode error;39char *str;40size_t len;41SDL_realloc_func realloc_func;42SDL_free_func free_func;43} SDL_error;4445// Defined in SDL_thread.c46extern SDL_error *SDL_GetErrBuf(bool create);4748// Macros to save and restore error values49#define SDL_PushError() \50char *saved_error = SDL_strdup(SDL_GetError())5152#define SDL_PopError() \53do { \54if (saved_error) { \55SDL_SetError("%s", saved_error); \56SDL_free(saved_error); \57} \58} while (0)5960#endif // SDL_error_c_h_616263