summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryangwei <[email protected]>2023-11-08 17:03:05 +0800
committeryangwei <[email protected]>2023-11-08 17:03:05 +0800
commit3f42d688d6565480ea868a44859ba20178ad1d58 (patch)
tree50981c0f26d63e6ec5ddca703966d962bcbc69df
parentfe8e4d942aeb1930b81db04dc0c7fefcb05dfb73 (diff)
🦄 refactor(eliminate lint warning): 消除语法检查告警v4.3.31
-rw-r--r--benchmark/example/test_plug.cpp2
-rw-r--r--include/private/stream_internal.h4
-rw-r--r--include/public/sapp_std.h5
-rw-r--r--src/dealpkt/plug_support.c8
4 files changed, 7 insertions, 12 deletions
diff --git a/benchmark/example/test_plug.cpp b/benchmark/example/test_plug.cpp
index efedd28..22a917d 100644
--- a/benchmark/example/test_plug.cpp
+++ b/benchmark/example/test_plug.cpp
@@ -15,7 +15,7 @@
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
-#include "sapp_benchmark.h"
+#include "../include/sapp_benchmark.h"
#ifdef __cplusplus
extern "C" {
diff --git a/include/private/stream_internal.h b/include/private/stream_internal.h
index a8261ba..679786f 100644
--- a/include/private/stream_internal.h
+++ b/include/private/stream_internal.h
@@ -49,9 +49,7 @@
#endif
#ifndef container_of
-#define container_of(ptr, type, member) ({ \
- const typeof( ((type *)0)->member ) *__mptr = (ptr); \
- (type *)( (char *)__mptr - offsetof(type,member) );})
+#define container_of(ptr, type, member) ((type *)((char *)(ptr) - offsetof(type, member)))
#endif
#define sapp_get_struct_header(ptr, type, member) container_of(ptr, type, member)
diff --git a/include/public/sapp_std.h b/include/public/sapp_std.h
index d8670f5..a3810e0 100644
--- a/include/public/sapp_std.h
+++ b/include/public/sapp_std.h
@@ -45,9 +45,8 @@ typedef struct {
#endif
#ifndef container_of
-#define container_of(ptr, type, member) ({ \
- const typeof( ((type *)0)->member ) *__mptr = (ptr); \
- (type *)( (char *)__mptr - offsetof(type,member) );})
+#define container_of(ptr, type, member) ((type *)((char *)(ptr) - offsetof(type, member)))
+
#endif
#define timeval_delta_ms(start, end) ((end.tv_sec-start.tv_sec)*1000 + (end.tv_usec-start.tv_usec)/1000)
diff --git a/src/dealpkt/plug_support.c b/src/dealpkt/plug_support.c
index 24dc415..75b6e68 100644
--- a/src/dealpkt/plug_support.c
+++ b/src/dealpkt/plug_support.c
@@ -1236,7 +1236,6 @@ static int MESA_get_stream_plug_pme(const struct streaminfo *pstream, void *opt_
{
int ret = 0;
struct mso_plug_pme *in_arg;
- const struct streaminfo_private *stream_pr;
struct tcpdetail_private *ptcp_detail_pr;
struct udpdetail_private *pudp_detail_pr;
@@ -1252,7 +1251,6 @@ static int MESA_get_stream_plug_pme(const struct streaminfo *pstream, void *opt_
}
in_arg = (struct mso_plug_pme *)opt_val;
- stream_pr = (struct streaminfo_private *)pstream;
in_arg->plug_pme = NULL;
this_plug_entry = plugin_get_plug_entry(in_arg->plug_name, in_arg->plug_entry_type);
@@ -1264,19 +1262,19 @@ static int MESA_get_stream_plug_pme(const struct streaminfo *pstream, void *opt_
if(STREAM_TYPE_TCP == pstream->type){
ptcp_detail_pr=(struct tcpdetail_private *)(pstream->pdetail);
- plug_pme = MESA_get_stream_plug_pme_from_platform_entry(ptcp_detail_pr->apme, this_plug_entry);
+ plug_pme = MESA_get_stream_plug_pme_from_platform_entry((const StreamFunInfo *)(ptcp_detail_pr->apme), this_plug_entry);
if(plug_pme != NULL){
in_arg->plug_pme = plug_pme;
goto bingo;
}
- plug_pme = MESA_get_stream_plug_pme_from_platform_entry(ptcp_detail_pr->pAllpktpme, this_plug_entry);
+ plug_pme = MESA_get_stream_plug_pme_from_platform_entry((const StreamFunInfo *)(ptcp_detail_pr->pAllpktpme), this_plug_entry);
if(plug_pme != NULL){
in_arg->plug_pme = plug_pme;
goto bingo;
}
}else if(STREAM_TYPE_UDP == pstream->type){
pudp_detail_pr = (struct udpdetail_private *)(pstream->pdetail);
- plug_pme = MESA_get_stream_plug_pme_from_platform_entry(pudp_detail_pr->apme, this_plug_entry);
+ plug_pme = MESA_get_stream_plug_pme_from_platform_entry((const StreamFunInfo *)(pudp_detail_pr->apme), this_plug_entry);
if(plug_pme != NULL){
in_arg->plug_pme = plug_pme;
goto bingo;