/** * Free the information storage. (not Manager) */ int ngcliLocalMachineInformationFree( ngclContext_t *context, ngclLocalMachineInformation_t *lmInfo, int *error) { int result; ngLog_t *log; static const char fName[] = "ngcliLocalMachineInformationFree"; /* Is context valid? */ result = ngcliContextIsValid(context, error); if (result == 0) { ngLogFatal(NULL, NG_LOGCAT_NINFG_PURE, fName, "Ninf-G Context is not valid.\n"); return 0; } log = context->ngc_log; /* Check the arguments */ if (lmInfo == NULL) { NGI_SET_ERROR(error, NG_ERROR_INVALID_ARGUMENT); ngclLogErrorContext(context, NG_LOGCAT_NINFG_PURE, fName, "Invalid argument.\n"); return 0; } ngiFree(lmInfo, log, error); return 1; }
static int ngcllLocalMachineInformationRelease( ngclContext_t *context, ngclLocalMachineInformation_t *lmInfo, int *error) { int result; ngLog_t *log; int ret = 1; static const char fName[] = "ngcllLocalMachineInformationRelease"; /* Check the arguments */ assert(context != NULL); if (lmInfo == NULL) { NGI_SET_ERROR(error, NG_ERROR_INVALID_ARGUMENT); ngclLogErrorContext(context, NG_LOGCAT_NINFG_PURE, fName, "Invalid argument.\n"); return 0; } log = context->ngc_log; /* Deallocate the members */ if (lmInfo->nglmi_hostName != NULL) ngiFree(lmInfo->nglmi_hostName, log, error); if (lmInfo->nglmi_tmpDir != NULL) ngiFree(lmInfo->nglmi_tmpDir, log, error); if (lmInfo->nglmi_invokeServerLog != NULL) ngiFree(lmInfo->nglmi_invokeServerLog, log, error); if (lmInfo->nglmi_commProxyLog != NULL) ngiFree(lmInfo->nglmi_commProxyLog, log, error); if (lmInfo->nglmi_infoServiceLog != NULL) ngiFree(lmInfo->nglmi_infoServiceLog, log, error); if (lmInfo->nglmi_signals != NULL) ngiFree(lmInfo->nglmi_signals, log, error); /* Release Log Information */ result = ngiLogInformationFinalize(&lmInfo->nglmi_logInfo, log, error); if (result == 0) { ngclLogErrorContext(context, NG_LOGCAT_NINFG_PURE, fName, "Can't release Log Information.\n"); error = NULL; ret = 0; } result = ngiLogLevelInformationFinalize(&lmInfo->nglmi_logLevels, log, error); if (result == 0) { ngclLogErrorContext(context, NG_LOGCAT_NINFG_PURE, fName, "Can't release Log Levels Information.\n"); error = NULL; ret = 0; } /* Initialize the members */ ngcllLocalMachineInformationInitializeMember(lmInfo); /* Success */ return ret; }
/** * Finish the measurement. */ int ngiSessionInformationFinishMeasurement( ngSessionInformation_t *info, ngLog_t *log, int *error) { /* Check the arguments */ assert(((info->ngsi_nCompressionInformations == 0) && (info->ngsi_compressionInformation == NULL)) || ((info->ngsi_nCompressionInformations > 0) && (info->ngsi_compressionInformation != NULL))); /* Deallocate */ if (info->ngsi_compressionInformation != NULL) ngiFree(info->ngsi_compressionInformation, log, error); /* Initialize the variables */ info->ngsi_nCompressionInformations = 0; info->ngsi_compressionInformation = NULL; /* Success */ return 1; }