Browse Source

ci: fix static analyser with assertions

Signed-off-by: Stephan Lachnit <stephanlachnit@debian.org>
Stephan Lachnit 2 years ago
parent
commit
9b44fc6def
1 changed files with 11 additions and 0 deletions
  1. 11 0
      lib/gamemode_client.h

+ 11 - 0
lib/gamemode_client.h

@@ -80,6 +80,8 @@ POSSIBILITY OF SUCH DAMAGE.
 #include <dlfcn.h>
 #include <string.h>
 
+#include <assert.h>
+
 #include <sys/types.h>
 
 static char internal_gamemode_client_error_string[512] = { 0 };
@@ -231,6 +233,9 @@ __attribute__((always_inline)) static inline const char *gamemode_error_string(v
 		return internal_gamemode_client_error_string;
 	}
 
+	/* Assert for static analyser that the function is not NULL */
+	assert(REAL_internal_gamemode_error_string != NULL);
+
 	return REAL_internal_gamemode_error_string();
 }
 
@@ -254,6 +259,9 @@ int gamemode_request_start(void)
 		return -1;
 	}
 
+	/* Assert for static analyser that the function is not NULL */
+	assert(REAL_internal_gamemode_request_start != NULL);
+
 	if (REAL_internal_gamemode_request_start() < 0) {
 #ifdef GAMEMODE_AUTO
 		fprintf(stderr, "gamemodeauto: %s\n", gamemode_error_string());
@@ -280,6 +288,9 @@ int gamemode_request_end(void)
 		return -1;
 	}
 
+	/* Assert for static analyser that the function is not NULL */
+	assert(REAL_internal_gamemode_request_end != NULL);
+
 	if (REAL_internal_gamemode_request_end() < 0) {
 #ifdef GAMEMODE_AUTO
 		fprintf(stderr, "gamemodeauto: %s\n", gamemode_error_string());