当前位置: 首页>>代码示例>>C++>>正文


C++ clHeapAllocate函数代码示例

本文整理汇总了C++中clHeapAllocate函数的典型用法代码示例。如果您正苦于以下问题:C++ clHeapAllocate函数的具体用法?C++ clHeapAllocate怎么用?C++ clHeapAllocate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了clHeapAllocate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: timeStamp

void timeStamp(ClCharT timeStr [], ClUint32T    len)
{
    time_t  timer ;
    struct  tm *t = NULL;
    ClCharT * pBuff =NULL;

   struct tm *localtimebuf = clHeapAllocate(sizeof(struct tm));;
   if(localtimebuf == NULL)
   {
      CL_DEBUG_PRINT(CL_DEBUG_ERROR,( "\nMemory Allocation failed\n"));
      return ;
   }
   ClCharT *asctimebuf   = clHeapAllocate(BUFFER_LENGTH*sizeof(ClCharT));
   if(asctimebuf == NULL)
   {
      CL_DEBUG_PRINT(CL_DEBUG_ERROR,( "\nMemory Allocation failed\n"));
      return ;
   }

   memset(&timer,0,sizeof(time_t));
    time(&timer);
    t = localtime_r(&timer,localtimebuf);
    pBuff=asctime_r(t,asctimebuf);
    strncpy(timeStr,pBuff,len-1);
    timeStr[strlen(timeStr) - 1] ='\0';
	clHeapFree(localtimebuf);
	clHeapFree(asctimebuf);
}
开发者ID:NguyenHoangOC,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:28,代码来源:clFaultHistory.c

示例2: clSnmpnameTableIndexTlvGet

ClRcT clSnmpnameTableIndexTlvGet(ClPtrT pIndexInfo, ClAlarmUtilTlvInfoPtrT pTlvList)
{
    ClAlarmUtilTlvT * pTlv = NULL;
    ClSnmpnameTableIndexInfoT * pnameTableIndex = (ClSnmpnameTableIndexInfoT *)pIndexInfo;

    if(!pIndexInfo || !pTlvList)
    {
        CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("NULL arguments received!"));
        return CL_ERR_NULL_POINTER;
    }
    pTlvList->pTlv = (ClAlarmUtilTlvT *) clHeapAllocate (1 * sizeof (ClAlarmUtilTlvT));
    if (pTlvList->pTlv == NULL)
    {
        clLog(CL_LOG_ERROR, CL_SNMP_AREA, CL_SNMP_GEN_OP_COTX, "nameTableIndexTlvGet unable to allocate memory!");
        return (CL_ERR_NO_MEMORY);
    }
    pTlvList->numTlvs = 1;

    pTlv = pTlvList->pTlv + 0;
    pTlv->value = clHeapAllocate (sizeof (ClUint32T));
    if (pTlv->value == NULL)
    {
        clHeapFree(pTlvList->pTlv);
        return (CL_ERR_NO_MEMORY);
    }
    memcpy(pTlv->value, &(pnameTableIndex->nodeAdd), sizeof (ClUint32T));
    pTlv->length = sizeof (ClUint32T);
    pTlv->type = CL_COR_UINT32;
    return CL_OK;
}
开发者ID:NguyenHoangOC,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:30,代码来源:clSnmpocTrainUtil.c

示例3: clFaultRecordPack

/*
 * This Api is used for packaging the fault structure
 * on query from the debug prompt
 */
ClRcT 
clFaultRecordPack(ClFaultRecordPtr hRec,ClCharT** retStr){

	ClUint32T categoryStringIndex=0,severityStringIndex=0,probableCauseStringIndex=0;
	
    if(hRec->seqNum==0)
    {
        clFaultCliStrPrint(retStr, "no record found");
    }
    else
    {
        ClCharT *str1 = NULL;
        ClCharT *tmp = NULL;


        str1 = clHeapAllocate(2000);/* The allocation size is a close indication
                                       of the number of bytes used to store the
                                       fault record structure */	   
        if(!str1)
            return CL_FAULT_RC(CL_ERR_NO_MEMORY);

        tmp = clHeapAllocate(2000);/* The allocatino size is a close measure of
                                      the number of bytes used to store each 
                                      attribute of a fault record structure 
                                      attached with a meaningful message
                                      preceeding it */
        if(!tmp)
            return CL_FAULT_RC(CL_ERR_NO_MEMORY);

        sprintf (tmp,"existing record found\n");
        strcat(str1,tmp);

        categoryStringIndex = clFaultInternal2CategoryTranslate((hRec->event).category);
        sprintf (tmp," Category........... %s\n",clFaultCategoryString[categoryStringIndex]);
        strcat(str1,tmp);

        sprintf (tmp," SpecificProblem.... %d\n",(hRec->event).specificProblem);
        strcat(str1,tmp);

        severityStringIndex = clFaultInternal2SeverityTranslate((hRec->event).severity);
        sprintf (tmp," Severity........... %s\n",clFaultSeverityString[severityStringIndex]);
        strcat(str1,tmp);

        if((hRec->event).cause >= CL_ALARM_PROB_CAUSE_LOSS_OF_SIGNAL &&
               (hRec->event).cause <= CL_ALARM_PROB_CAUSE_ENCLOSURE_DOOR_OPEN)
            probableCauseStringIndex = (hRec->event).cause;
        sprintf (tmp," cause.............. %s\n",clFaultProbableCauseString[probableCauseStringIndex]);
        strcat(str1,tmp);

        sprintf (tmp," SequenceNumber..... %d\n",(hRec->seqNum)-1);
        strcat(str1,tmp);
        clFaultCliStrPrint(retStr, str1);
        clHeapFree(str1);
        clHeapFree(tmp);
    }
	return CL_OK;
}
开发者ID:joaohf,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:61,代码来源:clFaultDebug.c

示例4: clAlarmPayloadCntAdd

/*
 * The cnt add function
 * The information is read from COR and then populated in the container
 * This api would be called as and when the object is created and the corresponding entry 
 * within the container needs to be added.
 */
ClRcT clAlarmPayloadCntAdd(ClAlarmInfoT *pAlarmInfo)
{
	ClRcT rc = CL_OK;
	ClCntNodeHandleT nodeH;
    ClAlarmPayloadCntT *payloadInfo;
    
    ClAlarmPayloadCntKeyT *pCntKey = clHeapAllocate(sizeof(ClAlarmPayloadCntKeyT));
    if(NULL == pCntKey)
    {
          CL_DEBUG_PRINT (CL_DEBUG_CRITICAL,("Memory allocation failed with rc 0x%x ", rc));
          return CL_ALARM_RC(CL_ALARM_ERR_NO_MEMORY);
    }    

    payloadInfo = NULL;
    pCntKey->probCause = pAlarmInfo->probCause;
    pCntKey->specificProblem = pAlarmInfo->specificProblem;
    pCntKey->moId = pAlarmInfo->moId;

    payloadInfo = clHeapAllocate(sizeof(ClAlarmPayloadCntT)+pAlarmInfo->len);
    if(NULL == payloadInfo)
    {
          CL_DEBUG_PRINT (CL_DEBUG_CRITICAL,("Memory allocation failed with rc 0x%x ", rc));
          clHeapFree(pCntKey);
          return CL_ALARM_RC(CL_ALARM_ERR_NO_MEMORY);
    }    
    payloadInfo->len = pAlarmInfo->len;
    memcpy(payloadInfo->buff, pAlarmInfo->buff, payloadInfo->len);

	clOsalMutexLock(gClAlarmPayloadCntMutex);        
    rc = clCntNodeFind(gPayloadCntHandle,(ClCntKeyHandleT)pCntKey,&nodeH);
	if(rc != CL_OK)
	{
		rc = clCntNodeAdd((ClCntHandleT)gPayloadCntHandle,
							(ClCntKeyHandleT)pCntKey,
							(ClCntDataHandleT)payloadInfo,
							NULL);
		if (CL_OK != rc)
		{
			CL_DEBUG_PRINT(CL_DEBUG_ERROR,("clCntNodeAdd failed with rc = %x\n", rc));
            clHeapFree(payloadInfo);
            clHeapFree(pCntKey);
        }
        CL_DEBUG_PRINT(CL_DEBUG_TRACE,("clCntNodeAdd adding payloadInfo->len : %d\n",payloadInfo->len));
	}
	else
	{
		CL_DEBUG_PRINT(CL_DEBUG_INFO,("Node already exist\n"));
        clHeapFree(payloadInfo);
        clHeapFree(pCntKey);
	}
	clOsalMutexUnlock(gClAlarmPayloadCntMutex);
	return rc;
}
开发者ID:NguyenHoangOC,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:59,代码来源:clAlarmPayloadCont.c

示例5: generate_time_of_day

static void
generate_time_of_day(char **data, ClSizeT *data_len)
{
    time_t t;

    // minimal error checking
    if (data == 0 || data_len == 0)
    {
        printf("generate_time_of_day passed null pointer\n");
        return;
    }

    // magic number, but well, that's what ctime_r needs
    *data_len = 26;
    *data = (char*)clHeapAllocate(*data_len);
    if (*data == 0)
    {
        *data_len = 0;
        return;
    }
    time(&t);
    ctime_r(&t, *data);
    *(*data + 24) = 0;
    (*data_len) -= 1;
    return;
}
开发者ID:joaohf,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:26,代码来源:externalMain.c

示例6: _clGmsDbOpen

ClRcT _clGmsDbOpen(
            CL_IN      const    ClUint64T   numOfGroups,
            CL_INOUT   ClGmsDbT** const     gmsDb)
{
    if (gmsDb == NULL) 
    {
        return CL_GMS_RC(CL_ERR_NULL_POINTER);
    }

    
    *gmsDb = (ClGmsDbT *) clHeapAllocate(sizeof(ClGmsDbT)
                                        * numOfGroups);

    if (*gmsDb == NULL)
    {
        return CL_GMS_RC(CL_ERR_NO_MEMORY);
    }

    memset(*gmsDb, 0, sizeof(ClGmsDbT)* numOfGroups);

    clLog(DBG,GEN,DB,
            "Created GMS master database successfully");

    return CL_OK;
}
开发者ID:NguyenHoangOC,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:25,代码来源:clGmsDb.c

示例7: appEventCallback

static void appEventCallback( SaEvtSubscriptionIdT	subscriptionId, SaEvtEventHandleT     eventHandle, SaSizeT eventDataSize)
{
    SaAisErrorT  saRc = SA_AIS_OK;
    static ClPtrT   resTest = 0;
    static ClSizeT  resSize = 0;
    if (resTest != 0)
    {
        // Maybe try to save the previously allocated buffer if it's big
        // enough to hold the new event message.
        clHeapFree((char *)resTest);
        resTest = 0;
        resSize = 0;
    }
    resTest = clHeapAllocate(eventDataSize + 1);
    if (resTest == 0)
    {
        printf("Failed to allocate space for event\n");
        return;
    }
    *(((char *)resTest) + eventDataSize) = 0;
    resSize = eventDataSize;
    saRc = saEvtEventDataGet(eventHandle, resTest, &resSize);
    if (saRc!= SA_AIS_OK)
    {
        printf("Failed to get event data [0x%x]\n",saRc);
    }
    printf ("Received event from internal node: %s\n", (char *)resTest);
    return;
}
开发者ID:joaohf,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:29,代码来源:externalMain.c

示例8: clMsgQueueCkptDataMarshal

ClRcT clMsgQueueCkptDataMarshal(ClMsgQueueCkptDataT *qCkptData, ClCachedCkptDataT *outData)
{
    ClRcT rc = CL_OK;
    ClUint8T *copyData;
    ClUint32T network_byte_order;

    saNameCopy(&outData->sectionName, &qCkptData->qName);
    outData->sectionAddress.iocPhyAddress = qCkptData->qAddress;
    outData->dataSize = CL_MSG_QUEUE_DATA_SIZE;

    outData->data = (ClUint8T *) clHeapAllocate(outData->dataSize);
    copyData = outData->data;

    network_byte_order = (ClUint32T) htonl((ClUint32T)qCkptData->qServerAddress.nodeAddress);
    memcpy(copyData, &network_byte_order, sizeof(ClUint32T));
    copyData = copyData + sizeof(ClUint32T);

    network_byte_order = (ClUint32T) htonl((ClUint32T)qCkptData->qServerAddress.portId);
    memcpy(copyData, &network_byte_order, sizeof(ClUint32T));
    copyData = copyData + sizeof(ClUint32T);

    network_byte_order = (ClUint32T) htonl((ClUint32T)qCkptData->state);
    memcpy(copyData, &network_byte_order, sizeof(ClUint32T));
    copyData = copyData + sizeof(ClUint32T);

    network_byte_order = (ClUint32T) htonl((ClUint32T)qCkptData->creationFlags);
    memcpy(copyData, &network_byte_order, sizeof(ClUint32T));
    copyData = copyData + sizeof(ClUint32T);

    return rc;
}
开发者ID:AlbertZheng,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:31,代码来源:clMsgCkptData.c

示例9: clEvtContTestDbInit

void clEvtContTestDbInit()
{
    ClRcT rc = CL_OK;
    ClUint32T noOfApp;

    rc = clCntLlistCreate(clEvtContSubKeyCompare, clEvtContSubDataDelete,
                          clEvtContSubDataDelete, CL_CNT_NON_UNIQUE_KEY,
                          &gEvtContSubInfo);
    if (CL_OK != rc)
    {
        clOsalPrintf("Creating linked list failed for sub \r\n");
        exit(-1);
    }

    rc = clCntLlistCreate(clEvtContPubKeyCompare, clEvtContPubDataDelete,
                          clEvtContPubDataDelete, CL_CNT_UNIQUE_KEY,
                          &gEvtContPubInfo);
    if (CL_OK != rc)
    {
        clOsalPrintf("Creating linked list failed for pub \r\n");
        exit(-1);
    }

    clEvtContGetApp(&noOfApp);
    clHeapAllocate(noOfApp * sizeof(ClEvtContSubInfoStorageT));

    return;
}
开发者ID:NguyenHoangOC,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:28,代码来源:emCont.c

示例10: clCpmNodeNameGet

ClRcT clCpmNodeNameGet(ClUint32T argc, ClCharT *argv[], ClCharT **retStr)
{
    ClRcT rc = CL_OK;
    ClNameT nodeName={0};
    *retStr = NULL;
    if(argc > 1 )
    {
        ClCharT tempStr[0x100];
        rc = CL_CPM_RC(CL_ERR_INVALID_PARAMETER);
        snprintf(tempStr, sizeof(tempStr),
                 "Usage: nodename\n");
        *retStr = (ClCharT *) clHeapAllocate(strlen(tempStr) + 1);
        if (*retStr)
            strcpy(*retStr, tempStr);
        goto out;
    }
    rc = clCpmLocalNodeNameGet(&nodeName);
    if(rc != CL_OK)
    {
        rc = CL_CPM_RC(CL_ERR_UNSPECIFIED);
        goto out;
    }
    *retStr = clHeapCalloc(1,nodeName.length+1);
    if(!*retStr)
    {
        rc = CL_CPM_RC(CL_ERR_NO_MEMORY);
        goto out;
    }
    strncpy(*retStr,nodeName.value,nodeName.length);
    rc = CL_OK;

    out:
    return rc;
}
开发者ID:NguyenHoangOC,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:34,代码来源:clCpmCliCommands.c

示例11: clFaultCliStrPrint

/* 
 * this api is used to print the error messages 
 * within the context where the fault cli comman
 * is being used
 */
void clFaultCliStrPrint(ClCharT** ppRet, ClCharT* pErrMsg, ...)
{
    ClUint32T   len = strlen(pErrMsg) + 100; 
    va_list     arg;

    va_start(arg, pErrMsg);
    *ppRet = (ClCharT *)clHeapAllocate(len);
    if( NULL != *ppRet )
    {
        memset(*ppRet, '\0', len);
        vsnprintf(*ppRet, len, pErrMsg, arg);
        va_end(arg);
        return;
    }
    else
    {
        va_end(arg);
        return;
    }
    

    /*
    ClUint32T len = strlen(str);

    *retStr = clHeapAllocate(len+1);
    if(NULL == retStr)
    {
        clLogWrite(CL_LOG_HANDLE_SYS, CL_LOG_CRITICAL,	CL_FAULT_SERVER_LIB,
				CL_LOG_MESSAGE_0_MEMORY_ALLOCATION_FAILED);
        return;
    }
    snprintf(*retStr, len+1, str);
    return;
    */
}
开发者ID:joaohf,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:40,代码来源:clFaultDebug.c

示例12: clAlarmPayloadCntDelete

/*
 * This api would be called as and when the object is no more and the corresponding entry 
 * within the container needs to be deleted.
 */
ClRcT clAlarmPayloadCntDelete(ClCorMOIdPtrT pMoId, ClAlarmProbableCauseT probCause, ClAlarmSpecificProblemT specificProblem)
{
	ClRcT rc = CL_OK;
	ClCntNodeHandleT nodeH;
    ClAlarmPayloadCntKeyT *pCntKey = clHeapAllocate(sizeof(ClAlarmPayloadCntKeyT));
    if(NULL == pCntKey)
    {
          CL_DEBUG_PRINT (CL_DEBUG_CRITICAL,("Memory allocation failed with rc 0x%x ", rc));
          return (rc);
    }    
    pCntKey->probCause = probCause;
    pCntKey->specificProblem = specificProblem;
    pCntKey->moId = *pMoId;

    clOsalMutexLock(gClAlarmPayloadCntMutex);        
    rc = clCntNodeFind(gPayloadCntHandle,(ClCntKeyHandleT)pCntKey,&nodeH);
	if(CL_OK == rc)
	{
    	rc = clCntAllNodesForKeyDelete(gPayloadCntHandle,(ClCntKeyHandleT)pCntKey);
    	if (CL_OK != rc)
	    {
        	CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("clCntAllNodesForKeyDelete failed w rc:0x%x\n", rc));
	    }        
	}
	else
	{
		CL_DEBUG_PRINT(CL_DEBUG_ERROR, ("Node does not exist with rc:0x%x\n", rc));
	}
    clHeapFree(pCntKey);
	clOsalMutexUnlock(gClAlarmPayloadCntMutex);    
	return rc;
}
开发者ID:NguyenHoangOC,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:36,代码来源:clAlarmPayloadCont.c

示例13: cpmFillCompConfig

void cpmFillCompConfig(const ClCpmMgmtCompT *compInfo,
                       ClCpmCompConfigT *compConfig)
{
    ClUint32T i = 0;
    
    strncpy(compConfig->compName, compInfo->compName, CL_MAX_NAME_LENGTH-1);
    compConfig->compProperty = compInfo->compProperty;
    compConfig->compProcessRel = compInfo->compProcessRel;
    strncpy(compConfig->instantiationCMD,
            compInfo->instantiationCMD,
            CL_MAX_NAME_LENGTH-1);

    /**
     * Put the image name as first argument.
     */
    
    compConfig->argv[0] = (ClCharT*) clHeapAllocate(strlen(compInfo->instantiationCMD)+1);
    if (!compConfig->argv[0])
    {
        clLogError(CPM_LOG_AREA_CPM, CPM_LOG_CTX_CPM_MGM,
                   "Unable to allocate memory");
        goto failure;
    }

    strncpy(compConfig->argv[0],
            compInfo->instantiationCMD,
            strlen(compInfo->instantiationCMD));
    
    for (i = 1; compInfo->argv[i]; ++i)
    {
        compConfig->argv[i] = (ClCharT*) clHeapAllocate(strlen(compInfo->argv[i]) + 1);
        if (!compConfig->argv[i])
        {
            clLogError(CPM_LOG_AREA_CPM, CPM_LOG_CTX_CPM_MGM,
                       "Unable to allocate memory");
            goto failure;
        }

        strncpy(compConfig->argv[i],
                compInfo->argv[i],
                strlen(compInfo->argv[i]));
    }
    compConfig->argv[i] = NULL;

failure:
    return;
}
开发者ID:mrv-communications-pilot,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:47,代码来源:clCpmMgmt.c

示例14: clCkptEntryUpdate

ClRcT clCkptEntryUpdate(ClCachedCkptSvcInfoT *serviceInfo,
                        const ClCachedCkptDataT *sectionData)
{
    ClRcT rc;

    SaCkptSectionIdT ckptSectionId = {        /* Section id for checkpoints   */
        sectionData->sectionName.length,
        (SaUint8T *) sectionData->sectionName.value
    };

    ClUint8T *ckptedData, *copyData;
    ClSizeT ckptedDataSize = sectionData->dataSize + sizeof(ClIocAddressT);
    ClUint32T network_byte_order;
    ClInt32T tries = 0;
    ClTimerTimeOutT delay = { 0,  500 };

    ckptedData = (ClUint8T *) clHeapAllocate(ckptedDataSize);
    if(ckptedData == NULL)
    {
        rc = CL_ERR_NO_MEMORY;
        clLogError("CCK", "UPD", "Failed to allocate memory. error code [0x%x].", rc);
        goto out1;
    }

    /* Marshall section data*/
    copyData = ckptedData;
    network_byte_order = (ClUint32T) htonl((ClUint32T)sectionData->sectionAddress.iocPhyAddress.nodeAddress);
    memcpy(copyData, &network_byte_order, sizeof(ClUint32T));
    copyData = copyData + sizeof(ClUint32T);
    network_byte_order = (ClUint32T) htonl((ClUint32T)sectionData->sectionAddress.iocPhyAddress.portId);
    memcpy(copyData, &network_byte_order, sizeof(ClUint32T));
    copyData = copyData + sizeof(ClUint32T);
    memcpy(copyData, sectionData->data, sectionData->dataSize);

    /* Try to update the section */
retry:
    rc = clCkptSectionOverwrite(serviceInfo->ckptHandle,         /* Checkpoint handle  */
                                (ClCkptSectionIdT *)&ckptSectionId,         /* Section ID         */
                                ckptedData,             /* Initial data       */
                                ckptedDataSize);        /* Size of data       */
    if (CL_ERR_TRY_AGAIN == CL_GET_ERROR_CODE(rc))
    {
        if ((++tries < 5) && (clOsalTaskDelay(delay) == CL_OK))
        {
            goto retry;
        }
    }
    if (rc != CL_OK)
    {
        clLogError("CCK", "UPD", "CkptSectionUpdate failed with rc [0x%x].",rc);
        goto out2;
    }

out2:
    clHeapFree(ckptedData);
out1:
    return rc;
}
开发者ID:mrv-communications-pilot,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:58,代码来源:clCachedCkpt.c

示例15: clCorMOIdNodeNameMapAdd

/* happens only once during the booting of the system */
ClRcT clCorMOIdNodeNameMapAdd(ClCorMOIdPtrT pMoId, ClNameT *nodeName)
{
    ClRcT rc;
    /* Add the mapping in both the hash tables */
    /* In this table key is node Name and value is MoId */
    /* allocate MoId first */
    ClCorMOIdPtrT keyMoId = clHeapAllocate(sizeof(ClCorMOIdT));
	ClNameT		  *dataNodeName  = clHeapAllocate (sizeof(ClNameT));
	ClNameT		  *keyNodeName  = clHeapAllocate (sizeof(ClNameT));
    ClCorNodeDataPtrT dataNode = clHeapAllocate(sizeof(ClCorNodeDataT));
    if(dataNode == NULL)
    { 
        CL_DEBUG_PRINT(CL_DEBUG_ERROR,("Failed to allocate Node Data")); 
        return CL_COR_SET_RC(CL_COR_ERR_NO_MEM) ;
    }
    memset(&dataNode->nodeName, 0, sizeof(ClNameT));
    dataNode->pMoId = clHeapAllocate(sizeof(ClCorMOIdT));

    if( keyMoId == NULL || dataNodeName == NULL || dataNode->pMoId == NULL || keyNodeName == NULL)
    {
		clLogWrite(CL_LOG_HANDLE_APP, CL_LOG_DEBUG, NULL,
				CL_LOG_MESSAGE_0_MEMORY_ALLOCATION_FAILED);
		CL_DEBUG_PRINT(CL_DEBUG_ERROR,(CL_COR_ERR_STR(CL_COR_ERR_NO_MEM)));
		return CL_COR_SET_RC(CL_COR_ERR_NO_MEM);
    }

    memcpy(keyMoId, pMoId, sizeof(ClCorMOIdT));
    memcpy(dataNodeName, nodeName, sizeof(ClNameT));
    memcpy(dataNode->pMoId, pMoId, sizeof(ClCorMOIdT));
    memcpy(&dataNode->nodeName, nodeName, sizeof(ClNameT));
    memcpy(keyNodeName, nodeName, sizeof(ClNameT));

    rc = clCntNodeAdd(nodeNameToMoIdTableHandle, (ClCntKeyHandleT) dataNodeName, (ClCntDataHandleT )dataNode , NULL);
    
    if(CL_OK != rc)
        CL_COR_RETURN_ERROR(CL_DEBUG_ERROR, "Could not add node in nodeNameToMoIdHandle", rc);    
    
    /* MOID to Node Name map - In this table key is MOId and value is node name   */
    rc = clCntNodeAdd(moIdToNodeNameTableHandle, (ClCntKeyHandleT) keyMoId, (ClCntDataHandleT)keyNodeName, NULL);

    if(CL_OK != rc)
        CL_COR_RETURN_ERROR(CL_DEBUG_ERROR, "Could not add node in moIdToNodeNameHandle", rc);    
    
    return CL_OK;
}
开发者ID:dharamjhatakia,项目名称:SAFplus-Availability-Scalability-Platform,代码行数:46,代码来源:clCorMoIdToNodeNameTable.c


注:本文中的clHeapAllocate函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。