Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP2:Update
wireshark
wireshark-0100-add-ws_return-macros-to-ws_asser...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File wireshark-0100-add-ws_return-macros-to-ws_assert.patch of Package wireshark
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 */
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor