/****************************************************************************** * * FUNCTION: void x_ipc_globalMFree(void) * * DESCRIPTION: * Free memory that x_ipc allocates in the module. * *****************************************************************************/ void x_ipc_globalMFree(void) { if (mGlobalp()) { LOCK_M_MUTEX; x_ipc_listFreeAllItems((LIST_FREE_FN)x_ipcFree, GET_M_GLOBAL(dataMsgBufferList)); x_ipc_listFree(&(GET_M_GLOBAL(dataMsgBufferList))); GET_M_GLOBAL(dataMsgBufferList) = NULL; x_ipc_listFree(&(GET_M_GLOBAL(Message_Ignore_Set))); GET_M_GLOBAL(Message_Ignore_Set) = NULL; x_ipc_hashTableFree(&GET_M_GLOBAL(classFormatTable), (HASH_ITER_FN)x_ipc_classEntryFree, NULL); x_ipc_hashTableFree(&GET_M_GLOBAL(formatNamesTable), (HASH_ITER_FN)x_ipc_formatFreeEntry, NULL); x_ipc_hashTableFree(&GET_M_GLOBAL(externalFdTable),x_ipc_hashItemsFree, NULL); if (GET_M_GLOBAL(logList)[0]) { x_ipcFree((char *)(GET_M_GLOBAL(logList)[0])->theFile); x_ipcFree((char *)GET_M_GLOBAL(logList)[0]); } GET_M_GLOBAL(logList)[0] = NULL; if (GET_M_GLOBAL(logList)[1]) { x_ipcFree((char *)(GET_M_GLOBAL(logList)[1])->theFile); x_ipcFree((char *)GET_M_GLOBAL(logList)[1]); } GET_M_GLOBAL(logList)[1] = NULL; x_ipc_freeContext(&GET_M_GLOBAL(currentContext)); x_ipc_listCleanup(); x_ipc_strListFree(&GET_M_GLOBAL(requiredResources), TRUE); x_ipcFree((char *)GET_M_GLOBAL(modNameGlobal)); if (GET_M_GLOBAL(byteFormat)) x_ipc_freeFormatter(&GET_M_GLOBAL(byteFormat)); if (GET_M_GLOBAL(charFormat)) x_ipc_freeFormatter(&GET_M_GLOBAL(charFormat)); if (GET_M_GLOBAL(shortFormat)) x_ipc_freeFormatter(&GET_M_GLOBAL(shortFormat)); if (GET_M_GLOBAL(intFormat)) x_ipc_freeFormatter(&GET_M_GLOBAL(intFormat)); if (GET_M_GLOBAL(longFormat)) x_ipc_freeFormatter(&GET_M_GLOBAL(longFormat)); if (GET_M_GLOBAL(floatFormat)) x_ipc_freeFormatter(&GET_M_GLOBAL(floatFormat)); if (GET_M_GLOBAL(doubleFormat)) x_ipc_freeFormatter(&GET_M_GLOBAL(doubleFormat)); x_ipc_listFreeAllItems((LIST_FREE_FN)x_ipcFree, GET_M_GLOBAL(timerList)); x_ipc_listFree(&(GET_M_GLOBAL(timerList))); #if defined(VXWORKS) x_ipcFree((char *)x_ipc_gM); x_ipc_gM = NULL; #else x_ipc_globalMInit(); x_ipcFree((char *)GET_M_GLOBAL(currentContext)); bzero((char *)&x_ipc_gM,sizeof(x_ipc_gM)); x_ipc_gM_ptr = NULL; #endif UNLOCK_M_MUTEX; } }
static void x_ipc_freeContext(X_IPC_CONTEXT_PTR *context) { if (!*context) return; x_ipcFree((char *)(*context)->servHostGlobal); x_ipc_freeContextList(&((*context)->queryNotificationList)); x_ipc_freeContextList(&((*context)->connectNotifyList)); x_ipc_freeContextList(&((*context)->disconnectNotifyList)); x_ipc_freeContextList(&((*context)->changeNotifyList)); LOCK_M_MUTEX; x_ipcRefFree(GET_M_GLOBAL(x_ipcRootNodeGlobal)); GET_M_GLOBAL(x_ipcRootNodeGlobal) = NULL; UNLOCK_M_MUTEX; x_ipc_freeContextList(&((*context)->x_ipcRefFreeList)); x_ipc_hashTableFree(&((*context)->moduleConnectionTable), x_ipc_hashItemsFree, NULL); x_ipc_hashTableFree(&((*context)->handlerTable), (HASH_ITER_FN) x_ipc_hndFree, NULL); x_ipc_hashTableFree(&((*context)->messageTable), (HASH_ITER_FN) x_ipc_msgFree, NULL); x_ipc_hashTableFree(&((*context)->resourceTable),x_ipc_hashItemsFree, NULL); x_ipc_idTableFree(&(*context)->hndIdTable); x_ipc_idTableFree(&(*context)->msgIdTable); x_ipc_listFreeAllItems((LIST_FREE_FN)x_ipc_dataMsgFree, (*context)->pendingReplies); x_ipc_listFree(&((*context)->pendingReplies)); (*context)->pendingReplies = NULL; x_ipcFree((char *)(*context)->msgQueue.messages); initMsgQueue(&(*context)->msgQueue); x_ipc_strListFree(&((*context)->tappedMsgs),TRUE); x_ipc_strListFree(&((*context)->broadcastMsgs),TRUE); x_ipc_listFree(&((*context)->queryNotificationList)); x_ipcFree((char *)*context); *context = NULL; }
static void x_ipc_tappedMsgVarHnd(X_IPC_REF_PTR Ref, STR_LIST_PTR tapped) { #ifdef UNUSED_PRAGMA #pragma unused(Ref) #endif MSG_PTR msg; LOCK_CM_MUTEX; x_ipc_strListFree(&GET_C_GLOBAL(tappedMsgs),TRUE); GET_C_GLOBAL(tappedMsgs) = tapped; STR_LIST_ITERATE(tapped, string, { LOCK_CM_MUTEX; msg = GET_MESSAGE(string); UNLOCK_CM_MUTEX; if (msg != NULL) { msg->direct = FALSE; }});
static void clearFormatParser (Format_Parse_Ptr formatParser) { if (formatParser->formatStack != NULL) x_ipc_strListFree(&formatParser->formatStack, FALSE); }