- changed internalID of HipadabaCallbacks to void*

This commit is contained in:
zolliker
2008-01-18 07:23:16 +00:00
parent 0c23e76179
commit 1bcb418ad4
2 changed files with 11 additions and 10 deletions

View File

@ -158,12 +158,12 @@ static pHdbCallback DeleteForID(pHdbCallback root, int id){
return result; return result;
} }
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
static pHdbCallback DeleteForInternalID(pHdbCallback root, int id){ static pHdbCallback DeleteForInternalID(pHdbCallback root, void *id){
pHdbCallback current = root; pHdbCallback current = root;
pHdbCallback tmp = NULL; pHdbCallback tmp = NULL;
pHdbCallback result = NULL; pHdbCallback result = NULL;
if(root == NULL){ if(root == NULL || id == NULL){
return NULL; return NULL;
} }
@ -729,7 +729,7 @@ char *GetHipadabaPath(pHdb node){
/*==================== Callback Functions ==================================*/ /*==================== Callback Functions ==================================*/
pHdbCallback MakeHipadabaCallback(hdbCallbackFunction func, pHdbCallback MakeHipadabaCallback(hdbCallbackFunction func,
void *userData, killUserData killFunc, void *userData, killUserData killFunc,
int id, int internalID){ int id, void *internalID){
pHdbCallback pNew = NULL; pHdbCallback pNew = NULL;
assert(func != NULL); assert(func != NULL);
@ -751,6 +751,7 @@ pHdbCallback MakeHipadabaCallback(hdbCallbackFunction func,
void AppendHipadabaCallback(pHdb node, int type, pHdbCallback newCB){ void AppendHipadabaCallback(pHdb node, int type, pHdbCallback newCB){
pHdbCallback current = NULL; pHdbCallback current = NULL;
assert(node);
switch(type){ switch(type){
case HCBSET: case HCBSET:
if(node->writeCallbacks == NULL){ if(node->writeCallbacks == NULL){
@ -860,7 +861,7 @@ void RemoveHipadabaCallback(pHdb root, int id){
} }
} }
/*----------------------------------------------------------------------------*/ /*----------------------------------------------------------------------------*/
void InternalRemoveHipadabaCallback(pHdb root, int internalID){ void InternalRemoveHipadabaCallback(pHdb root, void *internalID){
pHdb current = NULL; pHdb current = NULL;
root->writeCallbacks = DeleteForInternalID(root->writeCallbacks,internalID); root->writeCallbacks = DeleteForInternalID(root->writeCallbacks,internalID);

View File

@ -87,7 +87,7 @@ typedef struct __hdbcallback {
killUserData killFunc; killUserData killFunc;
hdbCallbackFunction userCallback; hdbCallbackFunction userCallback;
int id; int id;
int internalID; void *internalID;
struct __hdbcallback *next; struct __hdbcallback *next;
struct __hdbcallback *previous; struct __hdbcallback *previous;
}hdbCallback, *pHdbCallback; }hdbCallback, *pHdbCallback;
@ -250,14 +250,14 @@ int CountHdbChildren(pHdb node);
* @param killFunc A function for freeing the userData. Can be NULL, then it will * @param killFunc A function for freeing the userData. Can be NULL, then it will
* not be invoked * not be invoked
* @param id An ID associated with this callback * @param id An ID associated with this callback
* @param internalID Another ID to be associated with this callback. ID's come in * @param internalID Another ID to be associated with this callback. Typically a
* useful when callbacks have to be deleted in a later stage. * reference to the owner object responsible for deleting the callback.
* @return A new suitabvly initialised callback structure or NULL when required elements * @return A new suitabaly initialised callback structure or NULL when required elements
* are missing or there is nor memory. * are missing or there is nor memory.
*/ */
pHdbCallback MakeHipadabaCallback(hdbCallbackFunction func, pHdbCallback MakeHipadabaCallback(hdbCallbackFunction func,
void *userData, killUserData killFunc, void *userData, killUserData killFunc,
int id, int internalID); int id, void *internalID);
/** /**
* add a callback at the end of the callback chain * add a callback at the end of the callback chain
* @param node The node to which to append the callback * @param node The node to which to append the callback
@ -283,7 +283,7 @@ void RemoveHipadabaCallback(pHdb root, int id);
* @param root The starting node from where to start removing callbacks * @param root The starting node from where to start removing callbacks
* @param internalID The internal ID callbacks have to match in order to be removed. * @param internalID The internal ID callbacks have to match in order to be removed.
*/ */
void InternalRemoveHipadabaCallback(pHdb root, int internalID); void InternalRemoveHipadabaCallback(pHdb root, void *internalID);
/** /**
* invoke a callback chain. * invoke a callback chain.
* @param root The callback chain to invoke * @param root The callback chain to invoke