]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[core] Add type checking for SWITCH_CHANNEL_SESSION_LOG and SWITCH_CHANNEL_UUID_LOG...
authorChris Rienzo <chris@signalwire.com>
Thu, 21 Oct 2021 16:09:34 +0000 (16:09 +0000)
committerAndrey Volk <andywolk@gmail.com>
Sat, 23 Oct 2021 19:01:08 +0000 (22:01 +0300)
src/include/switch_types.h

index a4e40591760b93dbd66e4a7f499e0e7dde31bc4e..bb06cfa0ea1f3acf89b3890bb9a28f49517b160b 100644 (file)
@@ -1329,13 +1329,17 @@ typedef enum {
 } switch_core_session_message_flag_enum_t;
 typedef uint32_t switch_core_session_message_flag_t;
 
+typedef struct switch_core_session switch_core_session_t;
+static inline switch_core_session_t *switch_core_session_type_check(switch_core_session_t *session) { return session; }
+static inline const char *switch_const_char_type_check(const char *str) { return str; }
+
 #define SWITCH_CHANNEL_LOG SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
 #define SWITCH_CHANNEL_LOG_CLEAN SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
 #define SWITCH_CHANNEL_SESSION_LOG_CLEAN(x) SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__, switch_core_session_get_uuid((x))
 #define SWITCH_CHANNEL_EVENT SWITCH_CHANNEL_ID_EVENT, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
-#define SWITCH_CHANNEL_SESSION_LOG(x) SWITCH_CHANNEL_ID_SESSION, __FILE__, __SWITCH_FUNC__, __LINE__, (const char*)(x)
+#define SWITCH_CHANNEL_SESSION_LOG(x) SWITCH_CHANNEL_ID_SESSION, __FILE__, __SWITCH_FUNC__, __LINE__, (const char*)switch_core_session_type_check(x)
 #define SWITCH_CHANNEL_CHANNEL_LOG(x) SWITCH_CHANNEL_ID_SESSION, __FILE__, __SWITCH_FUNC__, __LINE__, (const char*)switch_channel_get_session(x)
-#define SWITCH_CHANNEL_UUID_LOG(x) SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, (x)
+#define SWITCH_CHANNEL_UUID_LOG(x) SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, switch_const_char_type_check(x)
 
 typedef enum {
        CCS_DOWN,
@@ -2336,7 +2340,6 @@ typedef struct switch_rtcp_frame switch_rtcp_frame_t;
 typedef struct switch_channel switch_channel_t;
 typedef struct switch_sql_queue_manager switch_sql_queue_manager_t;
 typedef struct switch_file_handle switch_file_handle_t;
-typedef struct switch_core_session switch_core_session_t;
 typedef struct switch_caller_profile switch_caller_profile_t;
 typedef struct switch_caller_extension switch_caller_extension_t;
 typedef struct switch_caller_application switch_caller_application_t;