Beispiel #1
0
void x_ipc_hndDelete(HND_PTR hnd)
{
  HND_KEY_TYPE hndKey;
  LIST_PTR msgList;
  LIST_ELEM_PTR listTmp;
  MODULE_PTR module;
  MSG_PTR msg;
  
  if (hnd) {
    if (hnd->hndLanguage == UNKNOWN_LANGUAGE) return;
    
    hnd->hndLanguage = UNKNOWN_LANGUAGE;
    
    hnd->msg = NULL;
    msgList = hnd->msgList;
    hnd->msgList = NULL; /* to revent recursion of free's */
    x_ipc_listTestDeleteItemAll((LIST_ITER_FN) x_ipc_removeHndFromMsg, 
			  (char *)hnd, msgList);
    
    x_ipc_listFree(&msgList);
    
    LOCK_CM_MUTEX;
    (void)x_ipc_idTableRemove(hnd->localId, GET_C_GLOBAL(hndIdTable));
    /* Need to remove from the module list.   */
    if (GET_M_GLOBAL(moduleList) != NULL) {
      for (listTmp = GET_M_GLOBAL(moduleList)->first; 
	   (listTmp != NULL);
	   listTmp = listTmp->next
	   ) {
	module = (MODULE_PTR)(listTmp->item);
	x_ipc_listDeleteItemAll(hnd,module->hndList);
      }
    }
    if (hnd->hndData) {
      hndKey.num = hnd->sd;
      hndKey.str = hnd->hndData->hndName;
      x_ipc_hashTableRemove((char *)&hndKey, GET_C_GLOBAL(handlerTable));
      msg = GET_MESSAGE(hnd->hndData->msgName);
      if (msg) x_ipc_removeHndFromMsg(hnd, msg);
      x_ipcFree((char *)hnd->hndData->msgName);
      hnd->hndData->msgName = NULL;
      x_ipcFree((char *)hnd->hndData->hndName);
      hnd->hndData->hndName = NULL;
      x_ipcFree((char *)hnd->hndData);
      hnd->hndData = NULL;
    }
    UNLOCK_CM_MUTEX;
    hnd->hndData = NULL;
    
    x_ipcFree((char *)hnd);
  }
}
Beispiel #2
0
void x_ipc_listFreeAllItems(LIST_FREE_FN func, LIST_PTR list)
{
  x_ipc_listTestDeleteItemAll((LIST_ITER_FN)x_ipc_listApplyFunc, (const void *)func, list);
}
Beispiel #3
0
void x_ipc_listDeleteItemAll(const void *item, LIST_PTR list)
{
  x_ipc_listTestDeleteItemAll((LIST_ITER_FN) x_ipc_listItemEq, item, list);
}