summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-07-24 16:42:14 +0800
committeryangwei <[email protected]>2024-07-24 16:42:14 +0800
commit8fd46fb28331a3899b7a813da08358776a821907 (patch)
tree51d520785da1d6371630435b0b5dd5720c819ea5 /examples
parent42149eae4a2eccd4bd104d8e5757766edd8cf477 (diff)
🔧 build(cmake): add UndefinedBehaviorSanitizerRefactor-mq-api
Diffstat (limited to 'examples')
-rw-r--r--examples/stellar_plugin/simple_stellar_plugin.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/examples/stellar_plugin/simple_stellar_plugin.c b/examples/stellar_plugin/simple_stellar_plugin.c
index a9cc0ee..aa6bc37 100644
--- a/examples/stellar_plugin/simple_stellar_plugin.c
+++ b/examples/stellar_plugin/simple_stellar_plugin.c
@@ -1,3 +1,5 @@
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+
#include "stellar/stellar.h"
#include "stellar/packet.h"
#include "stellar/session.h"
@@ -161,7 +163,7 @@ void simple_plugin_packet_get_exdata(struct packet *pkt, unsigned char ip_proto
{
struct simple_stellar_plugin_env *env = (struct simple_stellar_plugin_env *)plugin_env;
struct simple_stellar_plugin_env *exdata = (struct simple_stellar_plugin_env *)packet_exdata_get(pkt, env->packet_exdata_idx);
- assert(memcmp(env, exdata, sizeof(struct simple_stellar_plugin_env)) == 0);
+ if(memcmp(env, exdata, sizeof(struct simple_stellar_plugin_env)) != 0)abort();
return;
}
@@ -178,7 +180,7 @@ static void simple_plugin_packet_exdata_free(int idx, void *ex_ptr, void *arg)
struct simple_stellar_plugin_env *env = (struct simple_stellar_plugin_env *)arg;
assert(env);
struct simple_stellar_plugin_env *exdata = (struct simple_stellar_plugin_env *)ex_ptr;
- assert(memcmp(env, exdata, sizeof(struct simple_stellar_plugin_env)) == 0);
+ if(memcmp(env, exdata, sizeof(struct simple_stellar_plugin_env)) != 0)abort();
}
static void simple_plugin_packet_msg_free(void *msg, void *msg_free_arg)
@@ -186,7 +188,7 @@ static void simple_plugin_packet_msg_free(void *msg, void *msg_free_arg)
struct simple_stellar_plugin_env *env = (struct simple_stellar_plugin_env *)msg_free_arg;
assert(env);
struct simple_stellar_plugin_env *exdata = (struct simple_stellar_plugin_env *)msg;
- assert(memcmp(env, exdata, sizeof(struct simple_stellar_plugin_env)) == 0);
+ if(memcmp(env, exdata, sizeof(struct simple_stellar_plugin_env)) != 0)abort();
}
static void simple_plugin_on_packet_msg_cb(struct packet *pkt, int topic_id, const void *msg, void *plugin_env)
@@ -194,7 +196,7 @@ static void simple_plugin_on_packet_msg_cb(struct packet *pkt, int topic_id, con
struct simple_stellar_plugin_env *env = (struct simple_stellar_plugin_env *)plugin_env;
assert(env);
struct simple_stellar_plugin_env *exdata = (struct simple_stellar_plugin_env *)msg;
- assert(memcmp(env, exdata, sizeof(struct simple_stellar_plugin_env)) == 0);
+ if(memcmp(env, exdata, sizeof(struct simple_stellar_plugin_env)) != 0)abort();
}
void *simple_session_packet_plugin_init(struct stellar *st)