diff --git a/callback.c b/callback.c index beffabab..ab713fe5 100644 --- a/callback.c +++ b/callback.c @@ -230,7 +230,36 @@ iCurrent = LLDnodePtr2Next(self->iList); } return 1; - } + } +/*--------------------------------------------------------------------------*/ + int RemoveCallback3(pICallBack self, SICSCallBack pFunc, int (*func)(const void* context, const void* pUserData), void *context) + { + CallBackItem sItem; + int iCurrent; + + if(!CheckPointer(self)) + { + return 0; + } + + iCurrent = LLDnodePtr2First(self->iList); + while(iCurrent != 0) + { + LLDnodeDataTo(self->iList,&sItem); + if(sItem.pFunc == pFunc && func(context, sItem.pUserData) == 0) + { + if(sItem.pKill != NULL) + { + sItem.pKill(sItem.pUserData); + } + LLDnodeDelete(self->iList); + iCurrent = LLDnodePtr2First(self->iList); + continue; + } + iCurrent = LLDnodePtr2Next(self->iList); + } + return 1; + } /*------------------------------------------------------------------- a write function for the connection which writes to stdout -------------------------------------------------------------------*/ diff --git a/interface.h b/interface.h index 326e491d..4d6b203e 100644 --- a/interface.h +++ b/interface.h @@ -103,6 +103,7 @@ void *pUserData, KillFuncIT pKill); int RemoveCallback(pICallBack pInterface, long iID); int RemoveCallback2(pICallBack pInterface, void *pUserData); + int RemoveCallback3(pICallBack self, SICSCallBack pFunc, int (*func)(const void* context, const void* pUserData), void *context); int CallbackScript(SConnection *pCon, SicsInterp *pSics, void *pData, int argc, char *argv[]);