1 Star 0 Fork 15

hey_woods/libqb

forked from src-openEuler/libqb 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
libqb-fix-list-handling-gcc10.patch 1.17 KB
一键复制 编辑 原始数据 按行查看 历史
sigui 提交于 2021-02-25 19:10 . Upgrade to 1.0.5
From 4f0a30f4e05e140e1325784195e79c5ec62c689c Mon Sep 17 00:00:00 2001
From: Christine Caulfield <ccaulfie@redhat.com>
Date: Mon, 17 Feb 2020 16:28:57 +0000
Subject: [PATCH] list: fix list handling for gcc10
---
configure.ac | 1 -
include/qb/qblist.h | 4 ++--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/configure.ac b/configure.ac
index ec8736cb..108b2f18 100644
--- a/configure.ac
+++ b/configure.ac
@@ -558,7 +558,6 @@
suggest-attribute=noreturn
suggest-attribute=format
strict-prototypes
- pointer-arith
write-strings
cast-align
bad-function-cast
diff --git a/include/qb/qblist.h b/include/qb/qblist.h
index e3ae3f18..8064c874 100644
--- a/include/qb/qblist.h
+++ b/include/qb/qblist.h
@@ -193,8 +193,8 @@ static inline void qb_list_splice_tail(struct qb_list_head *list,
* @param type: the type of the struct this is embedded in.
* @param member: the name of the list_struct within the struct.
*/
-#define qb_list_entry(ptr,type,member)\
- ((type *)((char *)(ptr)-(char*)(&((type *)0)->member)))
+#define qb_list_entry(ptr,type,member) ({ \
+ ((type *)((void*)ptr - offsetof(type, member))); })
/**
* Get the first element from a list
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hey-woods/libqb.git
git@gitee.com:hey-woods/libqb.git
hey-woods
libqb
libqb
master

搜索帮助