Fixed naming conventions in some SDL_assert types, added compat #defines.
authorRyan C. Gordon <icculus@icculus.org>
Sat, 21 Feb 2015 00:33:25 -0500
changeset 9371375799828431
parent 9370 795d4866e4db
child 9372 a9bf04588f17
Fixed naming conventions in some SDL_assert types, added compat #defines.

Fixes Bugzilla #1997.
include/SDL_assert.h
     1.1 --- a/include/SDL_assert.h	Thu Feb 19 23:52:10 2015 -0500
     1.2 +++ b/include/SDL_assert.h	Sat Feb 21 00:33:25 2015 -0500
     1.3 @@ -102,9 +102,9 @@
     1.4      SDL_ASSERTION_ABORT,  /**< Terminate the program. */
     1.5      SDL_ASSERTION_IGNORE,  /**< Ignore the assert. */
     1.6      SDL_ASSERTION_ALWAYS_IGNORE  /**< Ignore the assert from now on. */
     1.7 -} SDL_assert_state;
     1.8 +} SDL_AssertState;
     1.9  
    1.10 -typedef struct SDL_assert_data
    1.11 +typedef struct SDL_AssertData
    1.12  {
    1.13      int always_ignore;
    1.14      unsigned int trigger_count;
    1.15 @@ -112,13 +112,13 @@
    1.16      const char *filename;
    1.17      int linenum;
    1.18      const char *function;
    1.19 -    const struct SDL_assert_data *next;
    1.20 -} SDL_assert_data;
    1.21 +    const struct SDL_AssertData *next;
    1.22 +} SDL_AssertData;
    1.23  
    1.24  #if (SDL_ASSERT_LEVEL > 0)
    1.25  
    1.26  /* Never call this directly. Use the SDL_assert* macros. */
    1.27 -extern DECLSPEC SDL_assert_state SDLCALL SDL_ReportAssertion(SDL_assert_data *,
    1.28 +extern DECLSPEC SDL_AssertState SDLCALL SDL_ReportAssertion(SDL_AssertData *,
    1.29                                                               const char *,
    1.30                                                               const char *, int)
    1.31  #if defined(__clang__)
    1.32 @@ -141,10 +141,10 @@
    1.33  #define SDL_enabled_assert(condition) \
    1.34      do { \
    1.35          while ( !(condition) ) { \
    1.36 -            static struct SDL_assert_data sdl_assert_data = { \
    1.37 +            static struct SDL_AssertData sdl_assert_data = { \
    1.38                  0, 0, #condition, 0, 0, 0, 0 \
    1.39              }; \
    1.40 -            const SDL_assert_state sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
    1.41 +            const SDL_AssertState sdl_assert_state = SDL_ReportAssertion(&sdl_assert_data, SDL_FUNCTION, SDL_FILE, SDL_LINE); \
    1.42              if (sdl_assert_state == SDL_ASSERTION_RETRY) { \
    1.43                  continue; /* go again. */ \
    1.44              } else if (sdl_assert_state == SDL_ASSERTION_BREAK) { \
    1.45 @@ -181,8 +181,8 @@
    1.46  #define SDL_assert_always(condition) SDL_enabled_assert(condition)
    1.47  
    1.48  
    1.49 -typedef SDL_assert_state (SDLCALL *SDL_AssertionHandler)(
    1.50 -                                 const SDL_assert_data* data, void* userdata);
    1.51 +typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)(
    1.52 +                                 const SDL_AssertData* data, void* userdata);
    1.53  
    1.54  /**
    1.55   *  \brief Set an application-defined assertion handler.
    1.56 @@ -199,7 +199,7 @@
    1.57   *
    1.58   *  This callback is NOT reset to SDL's internal handler upon SDL_Quit()!
    1.59   *
    1.60 - *  \return SDL_assert_state value of how to handle the assertion failure.
    1.61 + *  \return SDL_AssertState value of how to handle the assertion failure.
    1.62   *
    1.63   *  \param handler Callback function, called when an assertion fails.
    1.64   *  \param userdata A pointer passed to the callback as-is.
    1.65 @@ -246,7 +246,7 @@
    1.66   *  The proper way to examine this data looks something like this:
    1.67   *
    1.68   *  <code>
    1.69 - *  const SDL_assert_data *item = SDL_GetAssertionReport();
    1.70 + *  const SDL_AssertData *item = SDL_GetAssertionReport();
    1.71   *  while (item) {
    1.72   *      printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n",
    1.73   *             item->condition, item->function, item->filename,
    1.74 @@ -259,7 +259,7 @@
    1.75   *  \return List of all assertions.
    1.76   *  \sa SDL_ResetAssertionReport
    1.77   */
    1.78 -extern DECLSPEC const SDL_assert_data * SDLCALL SDL_GetAssertionReport(void);
    1.79 +extern DECLSPEC const SDL_AssertData * SDLCALL SDL_GetAssertionReport(void);
    1.80  
    1.81  /**
    1.82   *  \brief Reset the list of all assertion failures.
    1.83 @@ -270,6 +270,12 @@
    1.84   */
    1.85  extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void);
    1.86  
    1.87 +
    1.88 +/* these had wrong naming conventions until 2.0.4. Please update your app! */
    1.89 +#define SDL_assert_state SDL_AssertState
    1.90 +#define SDL_assert_data SDL_AssertData
    1.91 +
    1.92 +
    1.93  /* Ends C function definitions when using C++ */
    1.94  #ifdef __cplusplus
    1.95  }