From cef95312f021f781572657fbc9f62ba360fb06a0 Mon Sep 17 00:00:00 2001 From: m0_56903617 Date: Tue, 8 Jun 2021 06:14:26 +0800 Subject: [PATCH] =?UTF-8?q?202106080614=20=E5=A2=9E=E5=8A=A0=E4=BA=86ListI?= =?UTF-8?q?temDetach=E5=AE=8F=EF=BC=8C=E8=A7=A3=E5=86=B3=E5=9C=A8Destroy?= =?UTF-8?q?=E4=B8=AD=E4=B8=8D=E8=83=BD=E8=B0=83=E7=94=A8listDetach?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/dlist.h | 9 +++++++++ src/dlist.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/dlist.h b/include/dlist.h index 9320bfd..e67db21 100644 --- a/include/dlist.h +++ b/include/dlist.h @@ -31,6 +31,7 @@ * 修改记录: 202105140816: 根据git的要求增加License + 202106080611: 增加了ListItemDetach宏,解决在Destroy中不能调用listDetach的问题 */ #ifndef __DLIST_H @@ -117,6 +118,14 @@ int dlistInsertAfter(HOBJECT after, HOBJECT item); */ int dlistDetach(HOBJECT item); +#define ListItemDetach(pobj) \ +do { \ + pobj->__dlist_pLast->__dlist_pNext = pobj->__dlist_pNext; \ + pobj->__dlist_pNext->__dlist_pLast = pobj->__dlist_pLast; \ + pobj->__dlist_pLast = pobj; \ + pobj->__dlist_pNext = pobj; \ +} while (0) + /* 得到表中项的个数 */ diff --git a/src/dlist.c b/src/dlist.c index 43202ee..56765b8 100644 --- a/src/dlist.c +++ b/src/dlist.c @@ -243,7 +243,7 @@ QUERYINTERFACE_END static const char* dlistheaderModuleInfo() { - return "1.0.0-20210503.1247 Dual List Header"; + return "1.0.1-20210608.0612 Dual List Header"; } static int dlistheaderCreate(const PARAMITEM* pParams, int paramcount, HOBJECT* pObject) -- GitLab