Skip to content

Commit

Permalink
sdl/version: update GetRevisionNumber() to show deprecation warning o…
Browse files Browse the repository at this point in the history
…n staticcheck only when users use it

Signed-off-by: Lilis Iskandar <[email protected]>
  • Loading branch information
veeableful committed Aug 20, 2021
1 parent 933d50f commit 7a8aa8e
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions sdl/version.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
package sdl

// #include "sdl_wrapper.h"
/*
#include "sdl_wrapper.h"
#if SDL_VERSION_ATLEAST(2,0,16)
static inline int GetRevisionNumber(void)
{
return 0;
}
#else
static inline int GetRevisionNumber(void)
{
return SDL_GetRevisionNumber();
}
#endif
*/
import "C"
import "unsafe"

Expand Down Expand Up @@ -62,8 +80,7 @@ func GetRevision() string {
return (string)(C.GoString(C.SDL_GetRevision()))
}

// GetRevisionNumber returns the revision number of SDL that is linked against your program.
// (https://wiki.libsdl.org/SDL_GetRevisionNumber)
// Deprecated: GetRevisionNumber is deprecated in SDL2 2.0.16 and will return 0. Users should use GetRevision instead.
func GetRevisionNumber() int {
return (int)(C.SDL_GetRevisionNumber())
return (int)(C.GetRevisionNumber())
}

0 comments on commit 7a8aa8e

Please sign in to comment.