Index: wireshark-3.6.22/wsutil/ws_assert.h
===================================================================
--- wireshark-3.6.22.orig/wsutil/ws_assert.h
+++ wireshark-3.6.22/wsutil/ws_assert.h
@@ -12,6 +12,7 @@
 
 #include <ws_symbol_export.h>
 #include <ws_attributes.h>
+#include <wsutil/wslog.h>
 #include <stdbool.h>
 
 #ifdef WS_LOG_DOMAIN
@@ -76,6 +77,29 @@ void ws_assert_failed(const char *file,
         ws_assert_failed(__FILE__, __LINE__, __func__, \
                             _ASSERT_DOMAIN, NULL, true)
 
+/*
+ * These macros can be used as an alternative to ws_assert() to
+ * assert some condition on function arguments. This must only be used
+ * to catch programming errors, in situations where an assertion is
+ * appropriate. And it should only be used if failing the condition
+ * doesn't necessarily lead to an inconsistent state for the program.
+ *
+ * It is possible to set the fatal log domain to "InvalidArg" to abort
+ * execution for debugging purposes, if one of these checks fail.
+ */
+
+#define ws_warn_badarg(str) \
+    ws_info("bad argument: %s", str)
+
+#define ws_return_val_if(expr, val) \
+        do { \
+            if (expr) { \
+                ws_warn_badarg(#expr); \
+                return (val); \
+            } \
+        } while (0)
+
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
