diff --git a/hipadaba.c b/hipadaba.c index 4a359a95..087fadc7 100644 --- a/hipadaba.c +++ b/hipadaba.c @@ -64,10 +64,14 @@ pHdbMessage GetHdbKillNodeMessage(pHdbMessage toTest){ return NULL; } /*================== internal functions ===================================*/ -void DeleteCallbackChain(pHdbCallback root){ +void DeleteCallbackChain(pHdb node){ pHdbCallback current = NULL, thisEntry; + hdbMessage killNodeMsg; - current = root; + killNodeMsg.type = killNode; + InvokeCallbackChain(node, &killNodeMsg); + + current = node->callBackChain; while(current != NULL){ if(current->killFunc != NULL){ current->killFunc(current->userData); @@ -95,7 +99,8 @@ void DeleteNodeData(pHdb node){ if(node == NULL){ return; } - DeleteCallbackChain(node->callBackChain); + + DeleteCallbackChain(node); if(node->properties != NULL){ DeleteStringDict(node->properties); } @@ -595,15 +600,11 @@ void AddHipadabaChild(pHdb parent, pHdb child, void *callData){ /*--------------------------------------------------------------------------*/ void DeleteHipadabaNode(pHdb node, void *callData){ pHdb current = NULL, tmp = NULL; - hdbMessage killNodeMsg; if(node == NULL){ return; } - killNodeMsg.type = killNode; - InvokeCallbackChain(node, &killNodeMsg); - RemoveHdbNodeFromParent(node, callData); DeleteNodeData(node); diff --git a/hipadaba.h b/hipadaba.h index b4ec26f5..e94c7234 100644 --- a/hipadaba.h +++ b/hipadaba.h @@ -352,11 +352,11 @@ void *FindHdbCallbackData(pHdb node, void *userPtr); */ int InvokeCallbackChain(pHdb node, pHdbMessage message); /** - * Deletes a callback chain. This is internal, normal users - * should nto use this function. Or you create a mess! - * @param root The callback chain to remove + * Deletes the callback chain of a node. This is internal, normal users + * should not use this function. Or you create a mess! + * @param node The node */ -void DeleteCallbackChain(pHdbCallback root); +void DeleteCallbackChain(pHdb node); /** * apply message to the node and all its children * @param node Th node where to start recursing diff --git a/sicshipadaba.c b/sicshipadaba.c index 9bff97d9..6d0fe188 100644 --- a/sicshipadaba.c +++ b/sicshipadaba.c @@ -1176,7 +1176,7 @@ static void SICSDeleteNodeData(pHdb node){ if(node->properties != NULL){ DeleteStringDict(node->properties); } - DeleteCallbackChain(node->callBackChain); + DeleteCallbackChain(node); if(node->name != NULL){ free(node->name); @@ -2079,7 +2079,7 @@ static int DeleteHdbNode(SConnection *pCon, SicsInterp *pSics, void *pData, SCWrite(pCon,"ERROR: need path to node to delete",eError); return 0; } - killNode = GetHipadabaNode(root,argv[1]); + killNode = FindHdbNode(NULL, argv[1], pCon); if(killNode == NULL){ SCWrite(pCon,"ERROR: node to delete not found",eError); return 0; @@ -2998,7 +2998,7 @@ static int GetSICSHdbProperty(SConnection *pCon, SicsInterp *pSics, void *pData, } status = GetHdbProperty(targetNode,argv[2],buffer,511); if(status != 1){ - SCWrite(pCon,"ERROR: attribute not found",eValue); + SCPrintf(pCon,eValue,"ERROR: property %s not found", argv[2]); return 0; } SCPrintf(pCon,eValue,"%s.%s = %s", argv[1], argv[2], buffer);